Skip to content

issue: TypeError when creating/listing skills with PostgreSQL backend #21365

@mitchell-accipio

Description

@mitchell-accipio

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

8.0.0

Ollama Version (if applicable)

n/a

Operating System

Ubuntu Server 24.04

Browser (if applicable)

Any

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

  • Skill Creation: Skill is created successfully with HTTP 200, user is redirected to skills list

  • Skill Listing: All existing skills are displayed without errors

  • No exceptions in backend logs

Actual Behavior

Skill Creation

  • HTTP 400 error returned to browser

  • Error message: {"detail":"[ERROR: Error creating skill]"}

  • However: The skill IS successfully inserted into the PostgreSQL database

  • Backend traceback shows TypeError during db.refresh() call

Skill Listing

  • HTTP 200 response but skills list fails to render

  • Same TypeError when deserializing existing skill metadata

Backend Traceback (Full)

2026-02-13 12:03:52.506 | ERROR    | open_webui.models.skills:insert_new_skill:147 - Error creating a new skill: the JSON object must be str, bytes or bytearray, not dict

Traceback (most recent call last):
  File "/app/backend/open_webui/models/skills.py", line 138, in insert_new_skill
    db.refresh(result)
  ...
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/type_api.py", line 2169, in process
    return fixed_process_value(value, dialect)
  File "/app/backend/open_webui/internal/db.py", line 40, in process_result_value
    return json.loads(value)
           │    │     └ {'tags': []}
           │    └ <function loads at 0xe7ba421d5bc0><module 'json' from '/usr/local/lib/python3.11/json/__init__.py'>

TypeError: the JSON object must be str, bytes or bytearray, not dict

Key observation: value is already a Python dict {'tags': []}, not a JSON string.

Browser Console

POST https://intelligence.accipio.com/api/v1/skills/create [HTTP/2 400 61ms]
Response: {"detail":"[ERROR: Error creating skill]"}

Database State

Skills ARE inserted successfully:

SELECT id, name, meta FROM public.skill;
             id               |             name              |     meta
-------------------------------+-------------------------------+--------------
conversation-summariser-skill | Conversation Summariser Skill | {"tags": []}
testskill                     | TestSkill                     | {"tags": []}

The meta column is stored correctly as JSONB.

Steps to Reproduce

Prerequisites

  1. Deploy Open WebUI using Docker with PostgreSQL backend:

    docker run -d \
      --name openwebui \
      -p 8080:8080 \
      -e DATABASE_URL="postgresql://user:pass@host:5432/openwebui" \
      ghcr.io/open-webui/open-webui:main
  2. Ensure PostgreSQL database is accessible and migrations have run successfully

Reproduction Steps

Scenario A: Creating a New Skill

  1. Navigate to http://<your-instance>/workspace/skills/create

  2. Fill in the skill creation form:

    • ID: testskill

    • Name: Test Skill

    • Description: Test description

    • Content: You are a helpful assistant

    • Tags: (leave empty or add any tags)

  3. Click "Save"

Scenario B: Listing Existing Skills

  1. Create at least one skill using the UI (which will fail with 400 but still insert into DB)

  2. Navigate to http://<your-instance>/workspace/skills

  3. Observe the skills list page fails to render

Logs & Screenshots

2026-02-13 12:03:52.506 | ERROR    | open_webui.models.skills:insert_new_skill:147 - Error creating a new skill: the JSON object must be str, bytes or bytearray, not dict

Traceback (most recent call last):
  File "/app/backend/open_webui/models/skills.py", line 138, in insert_new_skill
    db.refresh(result)
  ...
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/type_api.py", line 2169, in process
    return fixed_process_value(value, dialect)
  File "/app/backend/open_webui/internal/db.py", line 40, in process_result_value
    return json.loads(value)
           │    │     └ {'tags': []}
           │    └ <function loads at 0xe7ba421d5bc0>
           └ <module 'json' from '/usr/local/lib/python3.11/json/__init__.py'>

TypeError: the JSON object must be str, bytes or bytearray, not dict

Additional Information

Disclaimer

Yes, this bug report used AI assistance to summarise and collate the information, but the troubleshooting was done by a human. Bleep Bloop.

Environment

  • Open WebUI Version: main (commit 4770285c04b81dfc3eb9ac173dfb2a8afef68105, built 2025-03-05T08:46:25.100Z)

  • Installation Method: Docker (ghcr.io/open-webui/open-webui:main)

  • Database: PostgreSQL 17.4 (AWS RDS)

  • Database Driver: psycopg2 (via SQLAlchemy)

  • Docker Version: 27.5.1

  • Host OS: Ubuntu 24.04 LTS (Linux 6.14.0-1017-aws aarch64)

  • Browser: Firefox 147.0 on Linux (reproducible on all browsers)

Relevant Environment Variables

DATABASE_URL=postgresql://user:pass@host:5432/openwebui
VECTOR_DB=pgvector
PGVECTOR_DB_URL=postgresql://user:pass@host:5432/openwebui_vectors
DATABASE_SCHEMA=public

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions