TypeError: __init__() missing 1 required keyword-only argument: 'created_by_role' #6234

Closed
opened 2026-02-21 18:14:39 -05:00 by yindo · 2 comments
Owner

Originally created by @luotian2020 on GitHub (Oct 22, 2024).

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.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I was using dify version 0.10.0 and calling the Knowledge Base API - Upload by Text Interface (/datasets/{dataset_id}/document/create_by_text), I encountered the following error: TypeError: init() missing 1 required keyword-only argument: 'created_by_role'. However, there was no issue when uploading through a file.
image
image

✔️ Expected Behavior

a successful json

Actual Behavior

an error json

Originally created by @luotian2020 on GitHub (Oct 22, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.10.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I was using dify version 0.10.0 and calling the Knowledge Base API - Upload by Text Interface (/datasets/{dataset_id}/document/create_by_text), I encountered the following error: TypeError: __init__() missing 1 required keyword-only argument: 'created_by_role'. However, there was no issue when uploading through a file. ![image](https://github.com/user-attachments/assets/0c37c9b4-fc8e-4476-aca3-e3a452bae173) ![image](https://github.com/user-attachments/assets/d8589ab3-395a-4605-b2be-f3eb856da48f) ### ✔️ Expected Behavior a successful json ### ❌ Actual Behavior an error json
yindo added the 🐞 bug label 2026-02-21 18:14:39 -05:00
yindo closed this issue 2026-02-21 18:14:39 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 22, 2024):

There is a similar issue that was reported and resolved. The error you're encountering, __init__() missing 1 required keyword-only argument: 'created_by_role', is related to the upload_text function missing the created_by_role parameter. This issue causes a server error (500) when using the create datasets document API.

To resolve this issue, ensure that the created_by_role parameter is correctly implemented and passed to the upload_text function. This might involve checking the function's implementation and any related code to ensure that the parameter is being handled properly. If the parameter is indeed missing, you may need to modify the function to include it and handle it appropriately [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 22, 2024): <!-- Answer --> There is a similar issue that was reported and resolved. The error you're encountering, `__init__() missing 1 required keyword-only argument: 'created_by_role'`, is related to the `upload_text` function missing the `created_by_role` parameter. This issue causes a server error (500) when using the create datasets document API. To resolve this issue, ensure that the `created_by_role` parameter is correctly implemented and passed to the `upload_text` function. This might involve checking the function's implementation and any related code to ensure that the parameter is being handled properly. If the parameter is indeed missing, you may need to modify the function to include it and handle it appropriately <sup>[[1]](https://github.com/langgenius/dify/issues/9418)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Oct 22, 2024):

Have you searched the existing issues?

@crazywoola commented on GitHub (Oct 22, 2024): Have you searched the existing issues? - https://github.com/langgenius/dify/issues/9592 - https://github.com/langgenius/dify/issues/9656
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6234