The variable function based on API is not working, and the variable tool for adding code in the old version is invalid. #1068

Closed
opened 2026-02-21 17:29:49 -05:00 by yindo · 2 comments
Owner

Originally created by @onlywangyh on GitHub (Feb 19, 2024).

Self Checks

Dify version

0.5.5

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

I used the API-based variable feature, but it is not working. It only supports text paragraphs and dropdown options. The code based on local development cannot implement the loading of variable functions.

✔️ Expected Behavior

The weather plugin is working normally.

Actual Behavior

I got the wrong response
{
"code": "invalid_param",
"message": "weather is required in input form",
"status": 400
}

Originally created by @onlywangyh on GitHub (Feb 19, 2024). ### Self Checks - [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 file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Dify version 0.5.5 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![image](https://github.com/langgenius/dify/assets/16820412/4f5eab34-97a5-4174-97ce-75151f20852e) I used the API-based variable feature, but it is not working. It only supports text paragraphs and dropdown options. The code based on local development cannot implement the loading of variable functions. ### ✔️ Expected Behavior The weather plugin is working normally. ### ❌ Actual Behavior I got the wrong response { "code": "invalid_param", "message": "weather is required in input form", "status": 400 }
yindo added the 🐞 bug label 2026-02-21 17:29:49 -05:00
yindo closed this issue 2026-02-21 17:29:49 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 19, 2024):

🤖

Hey there, @onlywangyh! Great to see you reaching out again. Hope you're doing well!

Based on the error message you provided, it seems like the issue is related to the "weather" parameter not being provided in the input form. This could be due to a variety of reasons, such as the parameter not existing in the API schema, the parameter being duplicated, the parameter being required but not provided, or the parameter not having a default value and no value being provided.

To troubleshoot this issue, you could check the following:

  1. Ensure that the "weather" parameter exists in the API schema. The parser checks for parameters in the 'parameters' field of the operation object (interface['operation']['parameters']). If the "weather" parameter is not listed there, it will not be recognized and could result in an "invalid_param" error.

  2. Check if the "weather" parameter is duplicated. The parser checks for duplicate parameters and raises a warning if it finds any ('Parameter {name} is duplicated.'). If the API or the tool you're using does not handle duplicate parameters correctly, this could result in an "invalid_param" error.

  3. Verify if the "weather" parameter is required but not provided. The parser checks if a parameter is required (parameter.get('required', False)). If a required parameter like "weather" is not provided, this could result in an "invalid_param" error.

  4. Check if the "weather" parameter does not have a default value and no value is provided. The parser checks if a parameter has a default value (parameter['default'] if 'default' in parameter else None). If a parameter like "weather" does not have a default value and no value is provided, this could result in an "invalid_param" error.

You can find more information about the parser in the parser.py file.

If you're still encountering issues after checking these possibilities, could you please provide more specific information about the "weather" parameter and the API schema? This would help in providing a more precise solution.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Feb 19, 2024): _🤖_ <!-- Greeting --> Hey there, @onlywangyh! Great to see you reaching out again. Hope you're doing well! <!-- Answer --> Based on the error message you provided, it seems like the issue is related to the "weather" parameter not being provided in the input form. This could be due to a variety of reasons, such as the parameter not existing in the API schema, the parameter being duplicated, the parameter being required but not provided, or the parameter not having a default value and no value being provided. To troubleshoot this issue, you could check the following: 1. Ensure that the "weather" parameter exists in the API schema. The parser checks for parameters in the 'parameters' field of the operation object (interface['operation']['parameters']). If the "weather" parameter is not listed there, it will not be recognized and could result in an "invalid_param" error. 2. Check if the "weather" parameter is duplicated. The parser checks for duplicate parameters and raises a warning if it finds any ('Parameter {name} is duplicated.'). If the API or the tool you're using does not handle duplicate parameters correctly, this could result in an "invalid_param" error. 3. Verify if the "weather" parameter is required but not provided. The parser checks if a parameter is required (parameter.get('required', False)). If a required parameter like "weather" is not provided, this could result in an "invalid_param" error. 4. Check if the "weather" parameter does not have a default value and no value is provided. The parser checks if a parameter has a default value (parameter['default'] if 'default' in parameter else None). If a parameter like "weather" does not have a default value and no value is provided, this could result in an "invalid_param" error. You can find more information about the parser in the [parser.py](https://github.com/langgenius/dify/blob/main/api/core/tools/utils/parser.py) file. If you're still encountering issues after checking these possibilities, could you please provide more specific information about the "weather" parameter and the API schema? This would help in providing a more precise solution. ## Sources - [api/core/tools/utils/parser.py](https://github.com/langgenius/dify/blob/main/api/core/tools/utils/parser.py) - [api/core/tools/provider/builtin/gaode/tools/gaode_weather.py](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/gaode/tools/gaode_weather.py) <!-- Dosu Comment Footer --> <details open> <summary> #### About Dosu </summary> This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. </details>
Author
Owner

@zxhlyh commented on GitHub (Feb 20, 2024):

fixed. #2490

@zxhlyh commented on GitHub (Feb 20, 2024): fixed. #2490
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1068