8000
Skip to content

[Bug] Notion sync fails with psycopg2.ProgrammingError: can't adapt type 'dict' in v1.13.0 #32705

@sameshin

Description

@sameshin

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.13.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Setup a Notion knowledge base.
  2. Modify a page on Notion.
  3. Click the "Sync" button in the Dify Knowledge base interface.

✔️ Expected Behavior

The synchronization should complete successfully, and the knowledge base content should be updated to the latest version.

❌ Actual Behavior

The sync finishes instantly without updating content. The docker-worker-1 log shows:
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'dict'

[Identified Cause & Fix]
The error occurs because data_source_info is passed as a dict type to the DB update in api/tasks/document_indexing_sync_task.py (around line 128). It must be serialized to a JSON string.

Proposed code changes:

  1. Add import json at the top of the file.
  2. Modify the assignment around line 128 as follows:

Before

document.data_source_info = data_source_info

After

document.data_source_info = json.dumps(data_source_info)

Applying this fix resolves the issue and allows the synchronization to complete normally.

This solution was generated with the assistance of Gemini 3 Flash.

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

      0