{"record":{"id":"0dd9de79a1353dfd","repo":"sveltejs/svelte","slug":"props-invalid-value","errorCode":"props_invalid_value","errorMessage":"props_invalid_value\nCannot do `bind:${key}={undefined}` when `${key}` has a fallback value\nhttps://svelte.dev/e/props_invalid_value","messagePattern":"props_invalid_value\nCannot do `bind:(.+?)=(.+?)` when `(.+?)` has a fallback value\nhttps://svelte\\.dev/e/props_invalid_value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/svelte/src/internal/client/errors.js","lineNumber":394,"sourceCode":"\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/sveltejs/svelte/blob/20b341f10048cf1016a2028ac7eee5595cfef6a5/packages/svelte/src/internal/client/errors.js#L376-L412","documentation":"Thrown at reactivity/props.js:329 during a two-way bind initialisation in runes mode when the bound prop value is undefined but the prop declares a fallback. Svelte cannot reconcile `bind:x={undefined}` with a fallback default because the fallback would write back, creating ambiguity about whether the parent or the fallback owns the value; in runes mode this is treated as a programming error.","triggerScenarios":"A parent does `bind:value={someVar}` where someVar is undefined, and the child component declares `let { value = 'default' } = $props()` (a fallback). The guard at props.js:325-331 fires when initial_value===undefined, fallback!==undefined, and runes is true.","commonSituations":"Binding to a state variable before it is initialised; binding form inputs to optional fields that may be undefined; refactoring a component to add a default and breaking existing callers that bind undefined.","solutions":["Initialise the bound variable on the parent side so it is never undefined: `let value = $state('')` instead of `let value`.","Remove the fallback from the child prop declaration if undefined is a valid bound value.","Use a plain prop (not bind) if the parent truly owns the value and undefined is meaningful."],"exampleFix":"// before\n// parent\nlet name; // undefined\n<Child bind:value={name} />\n// child\nlet { value = 'default' } = $props();\n\n// after — initialise on the parent\nlet name = $state('');\n<Child bind:value={name} />","handlingStrategy":"validation","validationCode":"// Initialise bound state variables before binding them to props with fallbacks.\n// parent: let value = $state(''); // not undefined\n// <Child bind:value={value} />\n// child: let { value = 'default' } = $props();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always initialise $state variables used in two-way bindings to a non-undefined value.","If undefined must be a valid bound value, remove the fallback from the child's prop declaration.","When adding a fallback default to a prop, audit existing callers that bind to it."],"tags":["svelte","runes","props","binding","two-way-binding"],"backgroundTag":null,"analyzedSha":"20b341f10048cf1016a2028ac7eee5595cfef6a5","analyzedAt":"2026-08-12T23:37:30.399Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}