{"record":{"id":"2bbcdd9ac0e32ca2","repo":"sveltejs/svelte","slug":"bind-invalid-checkbox-value","errorCode":"bind_invalid_checkbox_value","errorMessage":"bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value","messagePattern":"bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed\\. Use `bind:checked` instead\nhttps://svelte\\.dev/e/bind_invalid_checkbox_value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/svelte/src/internal/client/errors.js","lineNumber":33,"sourceCode":"\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_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/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/sveltejs/svelte/blob/20b341f10048cf1016a2028ac7eee5595cfef6a5/packages/svelte/src/internal/client/errors.js#L15-L51","documentation":"Runtime error `bind_invalid_checkbox_value`: using `bind:value` on an `<input type=\"checkbox\">` is disallowed. Checkboxes expose their state via the `checked` property, not `value`, so binding `value` would never reflect the toggled state. The fix is mechanical: switch to `bind:checked`. Production builds throw only the error URL.","triggerScenarios":"At runtime (DEV) when a checkbox input is bound with `bind:value`, e.g. `<input type=\"checkbox\" bind:value={flag}>`. Svelte detects the input type and throws on bind setup.","commonSituations":"Generically generated forms, design-system components that render the same `bind:value` for all input types, or copy-pasted form code where the input type was changed to checkbox without updating the binding.","solutions":["Change `bind:value` to `bind:checked` on the checkbox: `<input type=\"checkbox\" bind:checked={flag}>`.","If the field is part of a polymorphic input component, branch the binding directive on the input type.","For checkbox groups bound to an array, use `bind:group` instead."],"exampleFix":"// before\n<input type=\"checkbox\" bind:value={agree} />\n\n// after\n<input type=\"checkbox\" bind:checked={agree} />","handlingStrategy":"validation","validationCode":"// Scan templates for checkbox inputs with bind:value.\nfunction checkboxValueBind(source) {\n  return /<input\\b[^>]*\\btype=[\"']checkbox[\"'][^>]*\\bbind:value=/.test(source)\n      || /<input\\b[^>]*\\bbind:value=[^>]*\\btype=[\"']checkbox[\"']/.test(source);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize checkbox bindings on `bind:checked` (or `bind:group` for arrays).","In polymorphic input components, branch the directive on the input type.","Add a lint rule (e.g. eslint-plugin-svelte) that flags `bind:value` on checkboxes."],"tags":["svelte5","runtime","forms","binding","checkbox","input"],"backgroundTag":null,"analyzedSha":"20b341f10048cf1016a2028ac7eee5595cfef6a5","analyzedAt":"2026-08-12T23:37:30.399Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}