gohugoio/hugo · error · Error

Error reading from stdin

Error message

Error reading from stdin

What it means

The readInput loop calls Javy.IO.readSync on fd 0 (stdin). When that call throws and the error message does not contain 'os error 29' (the expected ESPIPE signal that stdin has closed), it rethrows a generic 'Error reading from stdin' because the underlying failure is unknown and uncategorised.

Source

Thrown at internal/warpc/js/common.js:28

	};

	console.error = (value) => {
		throw new Error(value);
	};

	// Read all the available bytes
	while (true) {
		// Stdin file descriptor
		const fd = 0;
		let bytesRead = 0;
		try {
			bytesRead = Javy.IO.readSync(fd, buffer);
		} catch (e) {
			// IO.readSync fails with os error 29 when stdin closes.
			if (e.message.includes('os error 29')) {
				break;
			}
			throw new Error('Error reading from stdin');
		}

		if (bytesRead < 0) {
			throw new Error('Error reading from stdin');
			break;
		}

		if (bytesRead === 0) {
			break;
		}

		currentLine = [...currentLine, ...buffer.subarray(0, bytesRead)];

		// Check for newline. If not, we need to read more data.
		if (!currentLine.includes(10)) {
			continue;
		}

View on GitHub (pinned to 52c9bd7908)

Solutions

  1. Verify the host feeds a valid, open stdin pipe for the full lifetime of the warpc invocation
  2. Ensure the producer closes stdin with EOF (os error 29) rather than aborting the pipe
  3. Inspect host-side logs for the underlying OS error
Defensive patterns

Strategy: try-catch

Try / catch

try { readInput(handle); } catch (e) { if (e.message === 'Error reading from stdin') { abortGracefully(); } else throw e; }

Prevention

When it happens

Trigger: Javy.IO.readSync throws an OS error other than 29 (e.g. bad file descriptor, permission denied, host I/O fault) while consuming the JSONL request stream.

Common situations: The stdin pipe is broken or aborted abnormally; the host process feeding the WASM module crashed; fd 0 was redirected to an unreadable source.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/e8fb1d787e1f4e5b. Report an issue: GitHub.