sveltejs/kit · error · SvelteKitError

Could not deserialize binary form: too short

Error message

Could not deserialize binary form: too short

What it means

Deserialization guard for binary form bodies: fewer bytes arrived than the fixed header requires (the stream ended before HEADER_BYTES could be read), so the payload is truncated and cannot even be inspected for a version. Reported via deserialize_error with reason 'too short'.

Source

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

		for await (const part of read_range(get_chunk, offset, length)) {
			parts.push(part);
			total += part.byteLength;
		}
		if (total < length || parts.length === 0) return null;
		// If the buffer is completely contained in one chunk, return the subarray as-is
		if (parts.length === 1) return parts[0];

		const buffer = new Uint8Array(length);
		let cursor = 0;
		for (const part of parts) {
			buffer.set(part, cursor);
			cursor += part.byteLength;
		}
		return buffer;
	}

	const header = await get_buffer(0, HEADER_BYTES);
	if (!header) throw deserialize_error('too short');

	if (header[0] !== BINARY_FORM_VERSION) {
		throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
	}
	const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
	const data_length = header_view.getUint32(1, true);
	const file_offsets_length = header_view.getUint16(5, true);

	// Validation uses embedded binary header fields (data_length, file_offsets_length)
	// rather than Content-Length, which proxies/middleboxes may strip or corrupt.
	// See: https://github.com/sveltejs/kit/issues/15299

	// Read the form data
	const data_buffer = await get_buffer(HEADER_BYTES, data_length);
	if (!data_buffer) throw deserialize_error('data too short');

	/** @type {Array<number | undefined>} */
	let file_offsets;

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Ensure the full serialized form payload is sent and not truncated by a proxy or size limit
  2. Increase body size limits on the server/proxy
  3. Retry the submission so a complete payload is produced
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/runtime/form-utils.js:246 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/ebdb632927984117. Report an issue: GitHub.