Skip to content

code bug, AttributeError: 'NoneType' object has no attribute 'display_status'. #9205

@glacierck

Description

@glacierck

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1.Update non-existent doc through API
curl --location --request POST 'http://192.168.1.210/v1/datasets/{dataset_id}/documents/{non-existent document_id}/update_by_file' ...

✔️ Expected Behavior

Return error code for non-existent document

❌ Actual Behavior

unknown error
{ "message": "Internal Server Error", "code": "unknown" }

debug info :
File "/app/api/services/dataset_service.py", line 978, in update_document_with_dataset_id if document.display_status != "available": AttributeError: 'NoneType' object has no attribute 'display_status'
Research on the source code reveals that the document has not been null checked!

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