Unable to get/list knowledge bases #8824

Closed
opened 2026-02-21 18:27:56 -05:00 by yindo · 4 comments
Owner

Originally created by @vlameiras on GitHub (Mar 1, 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

1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Create a new Knowledge Base (either empty or not), add a file and save. When accessing the main Knowledge section there are no Knowledge Base listed.

✔️ Expected Behavior

I expect to access Knowledge Bases that I create

Actual Behavior

I get no Knowledge Base listed and the following error on my browser console

http://localhost/console/api/datasets?page=1&limit=30 400 (BAD REQUEST)

As additional context, I get a persisting invalid plugin id notification. The only plugin I have installed is the OpenAI one.

Originally created by @vlameiras on GitHub (Mar 1, 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 1.0.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Create a new Knowledge Base (either empty or not), add a file and save. When accessing the main Knowledge section there are no Knowledge Base listed. ### ✔️ Expected Behavior I expect to access Knowledge Bases that I create ### ❌ Actual Behavior I get no Knowledge Base listed and the following error on my browser console ``` http://localhost/console/api/datasets?page=1&limit=30 400 (BAD REQUEST) ``` As additional context, I get a persisting `invalid plugin id` notification. The only plugin I have installed is the OpenAI one.
yindo added the 🐞 bug label 2026-02-21 18:27:56 -05:00
yindo closed this issue 2026-02-21 18:27:56 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 1, 2025):

Hello, @vlameiras! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm Dosu, a bot designed to assist you while you wait for a human maintainer.

I found a similar issue that was previously reported: Can not add a self-hosted knowledge API endpoint to DIFY via service's name. This issue was closed after a pull request was merged to fix the problem by allowing external knowledge API use with a simple host [1].

For your specific issue, a 400 (BAD REQUEST) error when listing knowledge bases can be caused by several factors. Here are some common causes and solutions:

  1. Special Characters in Query: If your query contains special characters like newlines (\n), ensure that the body format in your HTTP request is set to 'JSON' instead of 'raw' to properly escape these characters [2].

  2. Embedding Model Setup: Ensure that the Embedding model is set up in the system model settings, as this is necessary for creating a high-quality empty knowledge base and avoiding a 400 error [3].

  3. API Key and Authorization: Verify that your API key is correctly formatted and included in the HTTP Authorization header as Authorization: Bearer {API_KEY}. Incorrect or missing API keys can lead to authorization issues [4].

  4. Default Configurations: Check the default configurations in your self-hosted Docker environment, such as UPLOAD_FILE_SIZE_LIMIT and UPLOAD_FILE_BATCH_LIMIT, to ensure they are not affecting your operations [5].

If these solutions do not resolve the issue, you may want to review the specific error message returned by the API, which is typically {"code": "bad_request", "message": "The browser (or proxy) sent a request that this server could not understand.", "status": 400} [2]. This can provide more insight into what might be going wrong.

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 (Mar 1, 2025): <!-- Greeting --> Hello, @vlameiras! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm Dosu, a bot designed to assist you while you wait for a human maintainer. <!-- Answer --> I found a similar issue that was previously reported: [Can not add a self-hosted knowledge API endpoint to DIFY via service's name](https://github.com/langgenius/dify/issues/9917). This issue was closed after a pull request was merged to fix the problem by allowing external knowledge API use with a simple host <sup>[[1]](https://github.com/langgenius/dify/issues/9917)</sup>. For your specific issue, a 400 (BAD REQUEST) error when listing knowledge bases can be caused by several factors. Here are some common causes and solutions: 1. **Special Characters in Query**: If your query contains special characters like newlines (`\n`), ensure that the body format in your HTTP request is set to 'JSON' instead of 'raw' to properly escape these characters <sup>[[2]](https://github.com/langgenius/dify/issues/11643)</sup>. 2. **Embedding Model Setup**: Ensure that the Embedding model is set up in the system model settings, as this is necessary for creating a high-quality empty knowledge base and avoiding a 400 error <sup>[[3]](https://github.com/langgenius/dify/issues/12771)</sup>. 3. **API Key and Authorization**: Verify that your API key is correctly formatted and included in the HTTP Authorization header as `Authorization: Bearer {API_KEY}`. Incorrect or missing API keys can lead to authorization issues <sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/knowledge-and-documents-maintenance/maintain-dataset-via-api.md)</sup>. 4. **Default Configurations**: Check the default configurations in your self-hosted Docker environment, such as `UPLOAD_FILE_SIZE_LIMIT` and `UPLOAD_FILE_BATCH_LIMIT`, to ensure they are not affecting your operations <sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup>. If these solutions do not resolve the issue, you may want to review the specific error message returned by the API, which is typically `{"code": "bad_request", "message": "The browser (or proxy) sent a request that this server could not understand.", "status": 400}` <sup>[[2]](https://github.com/langgenius/dify/issues/11643)</sup>. This can provide more insight into what might be going wrong. <!-- 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/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/87942f49-83da-4529-9c27-dd2cfd11c327?feedback_type=other)</sup>
Author
Owner

@vlameiras commented on GitHub (Mar 1, 2025):

The API requests are the following (copied from browser's console)

curl 'http://localhost/console/api/datasets?page=1&limit=30' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,pt;q=0.7,es;q=0.6' \
  -H 'Authorization: Bearer REDACTED' \
  -H 'Connection: keep-alive' \
  -b 'session=nfvZPWtrU8ZX3GpyQDLB_w8fMxlA8FRj-9dL4izReEI; locale=en-US' \
  -H 'Referer: http://localhost/datasets/21d5a533-94c2-4898-8de3-b76476a4baa3/documents' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0' \
  -H 'content-type: application/json' \
  -H 'sec-ch-ua: "Chromium";v="134", "Not:A-Brand";v="24", "Microsoft Edge";v="134"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"'

{"code": "invalid_param", "message": "Invalid plugin id ", "status": 400}

The tips above don't seem to help. I also notice that I'm unable to create empty Knowledge Bases as it returns a 500 error when saving them

curl 'http://localhost/console/api/datasets/985e690d-b55e-4303-9b7b-baf2d9939f85' \
  -X 'PATCH' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,pt;q=0.7,es;q=0.6' \
  -H 'Authorization: Bearer REDACTED' \
  -H 'Connection: keep-alive' \
  -b 'session=nfvZPWtrU8ZX3GpyQDLB_w8fMxlA8FRj-9dL4izReEI; locale=en-US' \
  -H 'Origin: http://localhost' \
  -H 'Referer: http://localhost/datasets/985e690d-b55e-4303-9b7b-baf2d9939f85/settings' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0' \
  -H 'content-type: application/json' \
  -H 'sec-ch-ua: "Chromium";v="134", "Not:A-Brand";v="24", "Microsoft Edge";v="134"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  --data-raw '{"name":"test1","description":"","permission":"only_me","indexing_technique":null,"retrieval_model":{"search_method":"semantic_search","reranking_enable":false,"reranking_mode":null,"reranking_model":{"reranking_provider_name":"","reranking_model_name":""},"weights":null,"top_k":2,"score_threshold_enabled":false,"score_threshold":0},"embedding_model":"","embedding_model_provider":""}'

{"message": "Internal Server Error", "code": "unknown"}
@vlameiras commented on GitHub (Mar 1, 2025): The API requests are the following (copied from browser's console) ``` curl 'http://localhost/console/api/datasets?page=1&limit=30' \ -H 'Accept: */*' \ -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,pt;q=0.7,es;q=0.6' \ -H 'Authorization: Bearer REDACTED' \ -H 'Connection: keep-alive' \ -b 'session=nfvZPWtrU8ZX3GpyQDLB_w8fMxlA8FRj-9dL4izReEI; locale=en-US' \ -H 'Referer: http://localhost/datasets/21d5a533-94c2-4898-8de3-b76476a4baa3/documents' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-origin' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0' \ -H 'content-type: application/json' \ -H 'sec-ch-ua: "Chromium";v="134", "Not:A-Brand";v="24", "Microsoft Edge";v="134"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Windows"' {"code": "invalid_param", "message": "Invalid plugin id ", "status": 400} ``` The tips above don't seem to help. I also notice that I'm unable to create empty Knowledge Bases as it returns a 500 error when saving them ``` curl 'http://localhost/console/api/datasets/985e690d-b55e-4303-9b7b-baf2d9939f85' \ -X 'PATCH' \ -H 'Accept: */*' \ -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,pt;q=0.7,es;q=0.6' \ -H 'Authorization: Bearer REDACTED' \ -H 'Connection: keep-alive' \ -b 'session=nfvZPWtrU8ZX3GpyQDLB_w8fMxlA8FRj-9dL4izReEI; locale=en-US' \ -H 'Origin: http://localhost' \ -H 'Referer: http://localhost/datasets/985e690d-b55e-4303-9b7b-baf2d9939f85/settings' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-origin' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0' \ -H 'content-type: application/json' \ -H 'sec-ch-ua: "Chromium";v="134", "Not:A-Brand";v="24", "Microsoft Edge";v="134"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Windows"' \ --data-raw '{"name":"test1","description":"","permission":"only_me","indexing_technique":null,"retrieval_model":{"search_method":"semantic_search","reranking_enable":false,"reranking_mode":null,"reranking_model":{"reranking_provider_name":"","reranking_model_name":""},"weights":null,"top_k":2,"score_threshold_enabled":false,"score_threshold":0},"embedding_model":"","embedding_model_provider":""}' {"message": "Internal Server Error", "code": "unknown"} ```
Author
Owner

@crazywoola commented on GitHub (Mar 1, 2025):

Try to reinstall the embedding model and reselect the model in the knowledge settings.

@crazywoola commented on GitHub (Mar 1, 2025): Try to reinstall the embedding model and reselect the model in the knowledge settings.
Author
Owner

@vlameiras commented on GitHub (Mar 2, 2025):

Thanks. I sorted it by starting from scratch and deleting all volumes.

@vlameiras commented on GitHub (Mar 2, 2025): Thanks. I sorted it by starting from scratch and deleting all volumes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8824