dify - 💡(How to fix) Fix empty array recognized as null in http request [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#35596Fetched 2026-04-28 06:50:41
View on GitHub
Comments
3
Participants
2
Timeline
7
Reactions
1
Author
Participants
Timeline (top)
commented ×3closed ×1labeled ×1mentioned ×1

Error Message

This causes invalid JSON format (extra illegal comma),triggers a 400 parameter parsing error and request failure.

RAW_BUFFERClick to expand / collapse

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using the raw JSON format in the HTTP Request node to send POST requests,if I reference a variable from the previous node whose value is an empty list [],the empty list will be rendered as blank content in the final request body. This causes invalid JSON format (extra illegal comma),triggers a 400 parameter parsing error and request failure.

<img width="900" height="625" alt="Image" src="https://github.com/user-attachments/assets/c228445e-cccc-4d56-ac0c-a93590a9a1fb" /> <img width="454" height="730" alt="Image" src="https://github.com/user-attachments/assets/1127804a-0e52-40c4-bfa6-0693bc12b73e" />

✔️ Expected Behavior

Success request

❌ Actual Behavior

No response

extent analysis

TL;DR

The issue can be fixed by properly handling empty lists when referencing variables in the HTTP Request node to prevent invalid JSON format.

Guidance

  • Verify that the variable being referenced is indeed an empty list [] and not a string representation of an empty list.
  • Check the JSON formatting in the HTTP Request node to ensure it can handle empty lists correctly, potentially by adding conditional logic to remove the comma when the list is empty.
  • Consider using a JSON stringification function or method that can handle empty lists and produce valid JSON output.
  • Review the documentation for the HTTP Request node to see if there are any specific settings or options for handling empty lists or custom JSON formatting.

Example

// Example of invalid JSON with extra comma
{
  "key": [],
  "anotherKey": "value",
}

// Example of valid JSON without extra comma
{
  "key": [],
  "anotherKey": "value"
}

Notes

The exact solution may depend on the specific implementation of the HTTP Request node and the JSON formatting used. Additional debugging or logging may be necessary to determine the root cause of the issue.

Recommendation

Apply a workaround to handle empty lists in the JSON formatting, such as using conditional logic to remove the comma when the list is empty, to prevent invalid JSON format and request failures.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

dify - 💡(How to fix) Fix empty array recognized as null in http request [3 comments, 2 participants]