the parameter extraction node out log "__reason": "Invalid number of parameters" #13347

Closed
opened 2026-02-21 19:11:46 -05:00 by yindo · 3 comments
Owner

Originally created by @doonygit on GitHub (Apr 25, 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.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In the workflow, the parameter extraction node reports an exception, but during single-node debugging, there is no exception under the same parameter conditions.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @doonygit on GitHub (Apr 25, 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.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce In the workflow, the parameter extraction node reports an exception, but during single-node debugging, there is no exception under the same parameter conditions. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 19:11:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 25, 2025):

The "Invalid number of parameters" error in the parameter extraction node typically occurs when there is a mismatch between the expected parameters and the extracted parameters. Here are some steps you can take to resolve this issue:

  1. Check Parameter Definitions: Ensure that the number of parameters defined in your data matches the number of parameters expected in the result. Verify that all required parameters are present and correctly formatted according to their specified types, such as 'select', 'number', or 'bool' [1].

  2. Model Selection: If you are using the QwQ-32B-Preview model, consider switching to a non-reasoning model. The QwQ-32B-Preview model may have limitations in parameter extraction tasks [1].

  3. Inference Mode: Use the appropriate inference mode (function/tool call or prompt) based on the model's capabilities to improve parameter extraction accuracy [1].

  4. Payload Validation: Ensure that the payload includes a valid query and model provider, as these are required fields. The parameters themselves must have a name, type, and description [1].

  5. Vision Configuration: If the vision mode is enabled, verify that the vision configuration includes a variable selector [1].

These steps should help you address the "Invalid number of parameters" error in your self-hosted Docker setup.

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 (Apr 25, 2025): <!-- Answer --> The "Invalid number of parameters" error in the parameter extraction node typically occurs when there is a mismatch between the expected parameters and the extracted parameters. Here are some steps you can take to resolve this issue: 1. **Check Parameter Definitions**: Ensure that the number of parameters defined in your data matches the number of parameters expected in the result. Verify that all required parameters are present and correctly formatted according to their specified types, such as 'select', 'number', or 'bool' <sup>[[1]](https://github.com/langgenius/dify/issues/16152)</sup>. 2. **Model Selection**: If you are using the QwQ-32B-Preview model, consider switching to a non-reasoning model. The QwQ-32B-Preview model may have limitations in parameter extraction tasks <sup>[[1]](https://github.com/langgenius/dify/issues/16152)</sup>. 3. **Inference Mode**: Use the appropriate inference mode (function/tool call or prompt) based on the model's capabilities to improve parameter extraction accuracy <sup>[[1]](https://github.com/langgenius/dify/issues/16152)</sup>. 4. **Payload Validation**: Ensure that the payload includes a valid query and model provider, as these are required fields. The parameters themselves must have a name, type, and description <sup>[[1]](https://github.com/langgenius/dify/issues/16152)</sup>. 5. **Vision Configuration**: If the vision mode is enabled, verify that the vision configuration includes a variable selector <sup>[[1]](https://github.com/langgenius/dify/issues/16152)</sup>. These steps should help you address the "Invalid number of parameters" error in your self-hosted Docker setup. <!-- 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/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b19f3813-0354-4ed2-a7ef-6dea4425cf39?feedback_type=other)</sup>
Author
Owner

@wickhu commented on GitHub (May 13, 2025):

Image

If some parameters in parametes list is not required, extracted result from LLM will miss these parameters. It is acceptable for user if miss paramters will be filled with default value according to their type, but it can not pass this condition showing above image.

Of course, we can add extra prompt to tell LLM: "The parameter that did not appear retains the field name in the return result, but the parameter value is an empty string"

Shall we replace the condition with setting default value? Thanks for your consideration.

@wickhu commented on GitHub (May 13, 2025): ![Image](https://github.com/user-attachments/assets/6da023f7-aeed-4a86-bc8e-fa92f49de892) If some parameters in parametes list is not required, extracted result from LLM will miss these parameters. It is acceptable for user if miss paramters will be filled with default value according to their type, but it can not pass this condition showing above image. Of course, we can add extra prompt to tell LLM: "The parameter that did not appear retains the field name in the return result, but the parameter value is an empty string" Shall we replace the condition with setting default value? Thanks for your consideration.
Author
Owner

@CrabSAMA commented on GitHub (Nov 10, 2025):

@crazywoola Hey, sorry about disturb, but in Dify 1.9.2, I still face this issue. Why this issue be marked as completed? Maybe we need to further talk about this issue and fix it. If comment previous issue does not comply with community standards, I will try to new a issue, please tell me how to do next!

As wickhu said, this line actually incorrect: https://github.com/langgenius/dify/blob/9843fec3931ba791b09a3805e44fbe6636191996/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py#L543

If parameter extraction node have some non-required parameter, because of result field is extract by model, and prompt did not have any handler about non-required parameter, so len(result) length is likely that it will not be equal to len(data.parameters), InvalidNumberOfParametersError will have high probability raise.

Additionally, I found another issue that can also cause this error. _extract_complete_json_response maybe also have some bug:
https://github.com/langgenius/dify/blob/9843fec3931ba791b09a3805e44fbe6636191996/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py#L654-L667

For example, if reasoning model return thinking text have some json text, or normal model return text have some json unrelated to the final result, _extract_complete_json_response just extract the first json data, IMO it will cause some problem. It also will cause InvalidNumberOfParametersError.

Image

It will extract failed.

https://github.com/langgenius/dify/issues/16152#issuecomment-2757328158
As you said, the reasoning model is not good at extracting parameters, but non-reasoning model maybe also have cause problem.

@CrabSAMA commented on GitHub (Nov 10, 2025): @crazywoola Hey, sorry about disturb, but in Dify 1.9.2, I still face this issue. Why this issue be marked as completed? Maybe we need to further talk about this issue and fix it. If comment previous issue does not comply with community standards, I will try to new a issue, please tell me how to do next! As wickhu said, this line actually incorrect: https://github.com/langgenius/dify/blob/9843fec3931ba791b09a3805e44fbe6636191996/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py#L543 If parameter extraction node have some non-required parameter, because of `result` field is extract by model, and prompt did not have any handler about non-required parameter, so `len(result)` length is likely that it will not be equal to `len(data.parameters)`, `InvalidNumberOfParametersError` will have high probability raise. Additionally, I found another issue that can also cause this error. `_extract_complete_json_response` maybe also have some bug: https://github.com/langgenius/dify/blob/9843fec3931ba791b09a3805e44fbe6636191996/api/core/workflow/nodes/parameter_extractor/parameter_extractor_node.py#L654-L667 For example, if reasoning model return thinking text have some json text, or normal model return text have some json unrelated to the final result, `_extract_complete_json_response` just extract the first json data, IMO it will cause some problem. It also will cause `InvalidNumberOfParametersError`. <img width="752" height="242" alt="Image" src="https://github.com/user-attachments/assets/2ee6809b-6484-4a53-a182-f3c86b8ca9ce" /> It will extract failed. https://github.com/langgenius/dify/issues/16152#issuecomment-2757328158 As you said, the reasoning model is not good at extracting parameters, but non-reasoning model maybe also have cause problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13347