dify icon indicating copy to clipboard operation
dify copied to clipboard

"Knowledge" is not working: "tool invoke error: 'Document' object has no attribute 'doc_metadat'"

Open anthonylee1994 opened this issue 11 months ago • 11 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.0

Cloud or Self Hosted

Cloud

Steps to reproduce

Image

✔️ Expected Behavior

Get the knowledge content correctly

❌ Actual Behavior

throw "tool invoke error: 'Document' object has no attribute 'doc_metadat'"

anthonylee1994 avatar Mar 04 '25 10:03 anthonylee1994

@anthonylee1994 Hello! I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm a bot and I can assist you while we wait for a human maintainer.

The error you're encountering is due to a typo in the Dify 1.0.0 codebase, where the attribute 'doc_metadat' is incorrectly named and should be 'doc_metadata'. This issue has been addressed in a subsequent update. To resolve this error, you should update your Dify installation to the latest version that includes the fix from PR #14569 [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 04 '25 10:03 dosubot[bot]

I can confirm this issue in Dify Cloud v1.0.0. When the AI agent invokes a tool, it throws this error: tool invoke error: 'Document' object has no attribute 'doc_metadat'

fmobeireek avatar Mar 04 '25 10:03 fmobeireek

I am got a same issue.

xdmushui avatar Mar 05 '25 00:03 xdmushui

Indeed, whether Cloud or Self Hosted, v1.0.0.

CodeYuan94 avatar Mar 05 '25 02:03 CodeYuan94

{"dataset_90a85ed8_e34f_4da2_a93d_a3d9168be041": "tool invoke error: 'Document' object has no attribute 'doc_metadat'"} metoo

Zha0yuE avatar Mar 05 '25 06:03 Zha0yuE

+1

My Dify's version is 1.0.0 and run in Docker

This error is displayed when referencing the knowledge base

Image


retest, brnach: main, This error still occurs

Image

Image

sevck avatar Mar 05 '25 07:03 sevck

Should be fixed with #14569 but this hasn't been released yet.

perzeuss avatar Mar 05 '25 20:03 perzeuss

The code has been fixed, but the image hasn't been updated yet. This is how I solved the problem.

  1. docker exec -it container /bin/bash
  2. fix the file /app/api/core/tools/utils/dataset_retriever/dataset_retriever_tool.py
  3. docker commit old_ container langgenius/dify-api:1.0.1
  4. change docker/docker-compose.yaml. and fix langgenius/dify-api:1.0.0 to langgenius/dify-api:1.0.1(your new images)
  5. docker compose up -d
  6. will ok

zhoudaqiang avatar Mar 06 '25 07:03 zhoudaqiang

The code has been fixed, but the image hasn't been updated yet. This is how I solved the problem.

  1. docker exec -it container /bin/bash
  2. fix the file /app/api/core/tools/utils/dataset_retriever/dataset_retriever_tool.py
  3. docker commit old_ container langgenius/dify-api:1.0.1
  4. change docker/docker-compose.yaml. and fix langgenius/dify-api:1.0.0 to langgenius/dify-api:1.0.1(your new images)
  5. docker compose up -d
  6. will ok

Thank you~ A little more detail.

  1. docker exec -it your_container_name /bin/bash, replace your container name, mine is docker-api-1, you can by 'docker ps' command to check it
  2. fix the file at 175 line, you can use this command: sed -i '175c"doc_metadata": document.doc_metadata, # type:ignore' core/tools/utils/dataset_retriever/dataset_retriever_tool.py
  3. exit docker container
  4. docker commit your_container_name langgenius/dify-api:1.0.1
  5. edit your docker-compose.yaml file, replace all the dify-api version to 1.0.1
  6. docker compose up -d

9cc9 avatar Mar 11 '25 02:03 9cc9

Should be fixed with 1.0.1

perzeuss avatar Mar 11 '25 17:03 perzeuss

Hi, @anthonylee1994. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • Reported bug in Dify version 1.0.0 when accessing "Knowledge" due to a typo.
  • I suggested updating to the latest version with a fix from PR #14569.
  • Multiple users confirmed the error; a workaround was provided by zhoudaqiang.
  • perzeuss mentioned the fix should be in version 1.0.1, which is not yet released.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of Dify. If so, you can keep the discussion open by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Apr 11 '25 16:04 dosubot[bot]