dify tongyi api-key api 400 bad request #867

Closed
opened 2026-02-16 10:20:47 -05:00 by yindo · 3 comments
Owner

Originally created by @kww12138 on GitHub (Dec 11, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

{
"code": "invalid_param",
"message": "slice indices must be integers or None or have an index method",
"status": 400
}
api : https://aiyandu.cn:5678/console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/credentials

✔️ Expected Behavior

setup tong yi qian wen 's api-key as normal

Actual Behavior

When I upgrade dify version from 1.4.3 to 1.11, I cannot setup tong yi qian wen 's api-key , dify response 400 bad request from api. Details are as follows :
{
"code": "invalid_param",
"message": "slice indices must be integers or None or have an index method",
"status": 400
}
api : https://aiyandu.cn:5678/console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/credentials

Originally created by @kww12138 on GitHub (Dec 11, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce { "code": "invalid_param", "message": "slice indices must be integers or None or have an __index__ method", "status": 400 } api : https://aiyandu.cn:5678/console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/credentials ### ✔️ Expected Behavior setup tong yi qian wen 's api-key as normal ### ❌ Actual Behavior When I upgrade dify version from 1.4.3 to 1.11, I cannot setup tong yi qian wen 's api-key , dify response 400 bad request from api. Details are as follows : { "code": "invalid_param", "message": "slice indices must be integers or None or have an __index__ method", "status": 400 } api : https://aiyandu.cn:5678/console/api/workspaces/current/model-providers/langgenius/tongyi/tongyi/credentials
yindo added the bug label 2026-02-16 10:20:47 -05:00
yindo closed this issue 2026-02-16 10:20:47 -05:00
Author
Owner

@crazywoola commented on GitHub (Dec 11, 2025):

Please provide the plugin version as well.

@crazywoola commented on GitHub (Dec 11, 2025): Please provide the plugin version as well.
Author
Owner

@dosubot[bot] commented on GitHub (Dec 11, 2025):

This error is usually caused by a type mismatch in the plugin's backend code—specifically, the code tries to slice a list of prompt messages, but receives an unexpected type (not a list), often due to a malformed payload or missing dependencies in the plugin daemon's Python environment. This is a known issue with the Tongyi plugin in Dify 1.11, especially after upgrades or changes to the plugin environment.

Here’s how you can troubleshoot and often resolve it:

  1. Check the plugin daemon container logs for Python errors or missing dependencies related to the Tongyi plugin.
  2. Make sure all required dependencies are installed in the plugin’s .venv directory. If any are missing, install them manually and restart the plugin daemon.
  3. Double-check your plugin configuration parameters—ensure all values (like API keys) are strings and not other types.
  4. If you recently upgraded the plugin, try downgrading to a previous version (some users found downgrading resolved similar issues).
  5. Confirm your API key is valid and correctly formatted.

If the error persists, monitor the plugin daemon logs for silent failures or malformed responses, as these are often the root cause of this slice index error. More details and step-by-step instructions are available in this related issue.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 11, 2025): <!-- Answer --> This error is usually caused by a type mismatch in the plugin's backend code—specifically, the code tries to slice a list of prompt messages, but receives an unexpected type (not a list), often due to a malformed payload or missing dependencies in the plugin daemon's Python environment. This is a known issue with the Tongyi plugin in Dify 1.11, especially after upgrades or changes to the plugin environment. Here’s how you can troubleshoot and often resolve it: 1. Check the plugin daemon container logs for Python errors or missing dependencies related to the Tongyi plugin. 2. Make sure all required dependencies are installed in the plugin’s `.venv` directory. If any are missing, install them manually and restart the plugin daemon. 3. Double-check your plugin configuration parameters—ensure all values (like API keys) are strings and not other types. 4. If you recently upgraded the plugin, try downgrading to a previous version (some users found downgrading resolved similar issues). 5. Confirm your API key is valid and correctly formatted. If the error persists, monitor the plugin daemon logs for silent failures or malformed responses, as these are often the root cause of this slice index error. More details and step-by-step instructions are available in [this related issue](https://github.com/langgenius/dify/issues/29453). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c50f7b9c-101a-4096-852d-0b225744f1c2?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20error%20is%20usually%20caused%20by%20a%20type%20mismatch%20in%20the%20plugin%27s%20backend%20code%E2%80%94specifically%2C%20the%20code%20tries%20to%20slice%20a%20list%20of%20prompt%20messages%2C%20but%20receives%20an%20unexpected%20type%20%28not%20a%20list%29%2C%20often%20due%20to%20a%20malformed%20payload%20or%20missing%20dependencies%20in%20the%20plugin%20daemon%27s%20Python%20environment.%20This%20is%20a%20known%20issue%20with%20the%20Tongyi%20plugin%20in%20Dify%201.11%2C%20especially%20after%20upgrades%20or%20changes%20to%20the%20plugin%20environment.%0A%0AHere%E2%80%99s%20how%20you%20can%20troubleshoot%20and%20often%20resolve%20it%3A%0A%0A1.%20Check%20the%20plugin%20daemon%20container%20logs%20for%20Python%20errors%20or%20missing%20dependencies%20related%20to%20the%20Tongyi%20plugin.%0A2.%20Make%20sure%20all%20required%20dependencies%20are%20installed%20in%20the%20plugin%E2%80%99s%20%60.venv%60%20directory.%20If%20any%20are%20missing%2C%20install%20them%20manually%20and%20restart%20the%20plugin%20daemon.%0A3.%20Double-check%20your%20plugin%20configuration%20parameters%E2%80%94ensure%20all%20values%20%28like%20API%20keys%29%20are%20strings%20and%20not%20other%20types.%0A4.%20If%20you%20recently%20upgraded%20the%20plugin%2C%20try%20downgrading%20to%20a%20previous%20version%20%28some%20users%20found%20downgrading%20resolved%20similar%20issues%29.%0A5.%20Confirm%20your%20API%20key%20is%20valid%20and%20correctly%20formatted.%0A%0AIf%20the%20error%20persists%2C%20monitor%20the%20plugin%20daemon%20logs%20for%20silent%20failures%20or%20malformed%20responses%2C%20as%20these%20are%20often%20the%20root%20cause%20of%20this%20slice%20index%20error.%20More%20details%20and%20step-by-step%20instructions%20are%20available%20in%20%5Bthis%20related%20issue%5D%28https%3A//github.com/langgenius/dify/issues/29453%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/2234)
Author
Owner

@crazywoola commented on GitHub (Dec 11, 2025):

Should be fixed in linked PR

@crazywoola commented on GitHub (Dec 11, 2025): Should be fixed in linked PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#867