sveltejs/kit · error

`${type}` inputs must have a value

Error message

`${type}` inputs must have a value

What it means

Dev-time validation in the form element prop builder: for typed inputs like checkbox/radio (and other non-text inputs) a value attribute is mandatory so the form can serialize the field and match it against submitted data. This fires when such an input is created through the remote form component without a value option.

Source

Thrown at packages/kit/src/runtime/form-utils.js:817

				/** @type {Record<string, any>} */
				const base_props = {
					name: type_prefix + key + (is_array ? '[]' : '') + '/' + context.form_id,
					get 'aria-invalid'() {
						const issues = context.get_issues();
						return key in issues ? 'true' : undefined;
					}
				};

				// Add type attribute only for non-text inputs and non-select elements
				if (type !== 'text' && type !== 'select' && type !== 'select multiple') {
					base_props.type = type === 'file multiple' ? 'file' : type;
				}

				// Handle submit and hidden inputs
				if (type === 'submit' || type === 'hidden') {
					if (DEV) {
						if (input_value === null || input_value === undefined) {
							throw new Error(`\`${type}\` inputs must have a value`);
						}
					}

					return add_props(base_props, {
						value: typeof input_value === 'boolean' ? (input_value ? 'on' : 'off') : input_value
					});
				}

				// Handle select inputs
				if (type === 'select' || type === 'select multiple') {
					return add_props(base_props, {
						multiple: is_array,
						value: () => {
							const value = read(input_value);
							// copied, so the state array can't be edited through the props
							return Array.isArray(value) ? [...value] : value;
						}
					});

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Pass a value for the input, e.g. field('checkbox', 'option-a', { value: 'option-a' })
  2. Omit submit/hidden types that legitimately have no value, or supply a default value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/runtime/form-utils.js:817 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/70ae57c0aef9cf04. Report an issue: GitHub.