dataset API ".../update-by-file" fails normal requests due to an unnecessary required field validation #8576

Closed
opened 2026-02-21 18:26:25 -05:00 by yindo · 1 comment
Owner

Originally created by @StrayDragon on GitHub (Feb 24, 2025).

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

use official doc <YOUR_DIFY_WEB_HOST>/datasets?category=api example curl

checkout the api /datasets/{dataset_id}/documents/{document_id}/update-by-file

and use example curl like

curl --location --request POST 'http://ai.urchinet.lan/v1/datasets/{dataset_id}/documents/{document_id}/update-by-file' \
--header 'Authorization: Bearer {api_key}' \
--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \
--form 'file=@"/path/to/file"' | jq

✔️ Expected Behavior

200 OK response

Actual Behavior

got 400 response:

{
  "code": "invalid_param",
  "message": "1 validation error for KnowledgeConfig\nindexing_technique\n  Field required [type=missing, input_value={'doc_form': 'text_model'...45c5-b58f-642ae837a9b9'}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.9/v/missing",
  "status": 400
}
Originally created by @StrayDragon on GitHub (Feb 24, 2025). ### 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.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce use official doc `<YOUR_DIFY_WEB_HOST>/datasets?category=api` example curl checkout the api `/datasets/{dataset_id}/documents/{document_id}/update-by-file` and use example curl like ```sh curl --location --request POST 'http://ai.urchinet.lan/v1/datasets/{dataset_id}/documents/{document_id}/update-by-file' \ --header 'Authorization: Bearer {api_key}' \ --form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \ --form 'file=@"/path/to/file"' | jq ``` ### ✔️ Expected Behavior `200` OK response ### ❌ Actual Behavior got `400` response: ```json { "code": "invalid_param", "message": "1 validation error for KnowledgeConfig\nindexing_technique\n Field required [type=missing, input_value={'doc_form': 'text_model'...45c5-b58f-642ae837a9b9'}, input_type=dict]\n For further information visit https://errors.pydantic.dev/2.9/v/missing", "status": 400 } ```
yindo added the 🐞 bug label 2026-02-21 18:26:25 -05:00
yindo closed this issue 2026-02-21 18:26:25 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 24, 2025):

@StrayDragon Hello there! I'm Dosu, a bot here to help you with bug fixes, answer questions, and guide you on becoming a contributor. Let me know how I can assist you with the dataset API issue.

The error you're encountering indicates that the indexing_technique field is required but is missing or not correctly provided in the request. In the Dify codebase, the indexing_technique field is validated to ensure it is present and matches one of the allowed values, which are high_quality or economy [1][2].

To resolve this issue, ensure that the indexing_technique field is correctly included in your request payload. It should be part of the JSON data sent in the data form field, as shown in your example. Double-check that the JSON structure is correct and that the indexing_technique is properly specified.

If the issue persists, it might be due to a bug in the validation logic or the way the request is being processed. You may want to review the implementation of the /update-by-file endpoint to ensure it aligns with the expected input format and validation rules.

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] commented on GitHub (Feb 24, 2025): <!-- Greeting --> @StrayDragon Hello there! I'm Dosu, a bot here to help you with bug fixes, answer questions, and guide you on becoming a contributor. Let me know how I can assist you with the dataset API issue. <!-- Answer --> The error you're encountering indicates that the `indexing_technique` field is required but is missing or not correctly provided in the request. In the Dify codebase, the `indexing_technique` field is validated to ensure it is present and matches one of the allowed values, which are `high_quality` or `economy` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/controllers/console/datasets/datasets_document.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/(commonLayout)/datasets/template/template.en.mdx)</sup>. To resolve this issue, ensure that the `indexing_technique` field is correctly included in your request payload. It should be part of the JSON data sent in the `data` form field, as shown in your example. Double-check that the JSON structure is correct and that the `indexing_technique` is properly specified. If the issue persists, it might be due to a bug in the validation logic or the way the request is being processed. You may want to review the implementation of the `/update-by-file` endpoint to ensure it aligns with the expected input format and validation rules. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1317690b-5234-49bf-9c31-5168308332e2?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8576