You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Embedded chatbot drops numeric zero defaults and required number values #43242
This is only for bug report, if you would like to ask a question, please head to Discussions.
I have searched for existing issues, including closed ones.
I confirm that I am using English to submit this report.
Please do not modify this template.
Dify version
1.17.1, main at 7b0660b4.
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
Create an app with an embedded chatbot and a required Number input whose default value is 0, or open the embedded chatbot with a URL-provided value of 0.
Render the embedded chatbot input form.
Observe the Number input value and try to start the conversation.
A focused regression test on current main reproduces the issue without a model provider.
Expected Behavior
Numeric 0 is a valid Number input value. It should be preserved from app defaults and URL parameters, rendered in the form, and accepted by the required-field validation.
Actual Behavior
Numeric 0 is treated as empty throughout the embedded chatbot input flow:
A URL parameter such as n1=0 is replaced by the app default instead of preserving 0.
A Number input value of numeric 0 renders as an empty field.
A required Number input with numeric 0 is rejected when starting the conversation.
Root Cause
The embedded chatbot form uses truthiness checks in several places:
web/app/components/base/chat/embedded-chatbot/hooks.tsx maps the parsed Number value with convertedNumber || item.default || item.number.default.
The default-input initialization uses item.default || null.
The failures cover URL parameter 0, required Number 0, and rendering numeric 0 from context.
Additional Context
This differs from workflow Test Run validation in #43240: the affected component and state path here are the embedded chatbot's default/input lifecycle.
Hi @0204zll! I'm Dosu and I'm helping the Dify team.
All four truthiness-check sites you identified exist in web/app/components/base/chat/embedded-chatbot/hooks.tsx and inputs-form/content.tsx:
The number default computation, default: convertedNumber || item.default || item.number.default[1], falls through to the app-level default whenever convertedNumber is 0, so a URL param like n1=0 gets overwritten.
The new-conversation input seeding, conversationInputs[item.variable] = item.default || null[2], replaces a default of 0 with null.
The required-field check in checkInputsRequired, if (!newConversationInputsRef.current[variable] && !silent)[3], flags a required Number field of 0 as empty. So does the matching check in chat-wrapper.tsx's inputDisabled memo, if (!inputsFormValue?.[variable]) hasEmptyInput = label[4].
The render layer, value={inputsFormValue?.[form.variable] || ''}[5], shows 0 as a blank input.
The sibling chat-with-history flow contains the same item.default || null pattern and the same !newConversationInputsRef.current[variable] and !inputsFormValue?.[variable] checks verbatim [6][7][8]. A fix limited to embedded-chatbot would likely leave the bug in place there.
This is the same class of bug as #43240, which was just filed for Workflow Test Run rejecting 0. It already has an open fix, PR #43241, which changes the required-field guard in check-input-forms-hooks.ts from if (!inputs[variable]) to if (!inputs[variable] && inputs[variable] !== 0). That PR only touches the shared workflow validator hook, not embedded-chatbot/hooks.tsx, chat-wrapper.tsx, or inputs-form/content.tsx, so it won't resolve the paths reported here.
For the render layer, before-run-form/form-item.tsx already avoids this by rendering value == null || value === '' ? null : Number(value) instead of a truthiness check [9]. A similar approach would fix all four sites you listed: a value === undefined || value === null || value === '' ? '' : value guard for rendering, plus item.default ?? null and variable in obj ? obj[variable] : ... in place of ||.
Your regression tests already reproduce this, and the fix for #43240 is in progress. That makes this a good candidate for a companion PR covering these four call sites and their chat-with-history counterparts.
Activity
dosubot commentedon Sep 29, 2026
Hi @0204zll! I'm Dosu and I'm helping the Dify team.
All four truthiness-check sites you identified exist in
web/app/components/base/chat/embedded-chatbot/hooks.tsxandinputs-form/content.tsx:default: convertedNumber || item.default || item.number.default[1], falls through to the app-level default wheneverconvertedNumberis0, so a URL param liken1=0gets overwritten.conversationInputs[item.variable] = item.default || null[2], replaces a default of0withnull.checkInputsRequired,if (!newConversationInputsRef.current[variable] && !silent)[3], flags a required Number field of0as empty. So does the matching check inchat-wrapper.tsx'sinputDisabledmemo,if (!inputsFormValue?.[variable]) hasEmptyInput = label[4].value={inputsFormValue?.[form.variable] || ''}[5], shows0as a blank input.The sibling
chat-with-historyflow contains the sameitem.default || nullpattern and the same!newConversationInputsRef.current[variable]and!inputsFormValue?.[variable]checks verbatim [6] [7] [8]. A fix limited toembedded-chatbotwould likely leave the bug in place there.This is the same class of bug as #43240, which was just filed for Workflow Test Run rejecting
0. It already has an open fix, PR #43241, which changes the required-field guard incheck-input-forms-hooks.tsfromif (!inputs[variable])toif (!inputs[variable] && inputs[variable] !== 0). That PR only touches the shared workflow validator hook, notembedded-chatbot/hooks.tsx,chat-wrapper.tsx, orinputs-form/content.tsx, so it won't resolve the paths reported here.For the render layer,
before-run-form/form-item.tsxalready avoids this by renderingvalue == null || value === '' ? null : Number(value)instead of a truthiness check [9]. A similar approach would fix all four sites you listed: avalue === undefined || value === null || value === '' ? '' : valueguard for rendering, plusitem.default ?? nullandvariable in obj ? obj[variable] : ...in place of||.Your regression tests already reproduce this, and the fix for #43240 is in progress. That makes this a good candidate for a companion PR covering these four call sites and their
chat-with-historycounterparts.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
Stream29 commentedon Oct 11, 2026
Reproduced the URL zero-value fallback in the published embedded chatbot on self-hosted Docker 1.17.1.
amountwith default1, and publish./chatbot/<app-code>with the gzip + base64 encoded value0:A read-only check confirmed that the actual URL parameter decoded to
0.