gohugoio/hugo · error · Error

${value}

Error message

${value}

What it means

Hugo's warpc (WASM RPC) JS runtime overrides console.error (common.js:12-14) to throw, because QuickJS/Javy does not implement console.error natively. Any call to console.error inside a warpc module is converted into a thrown Error so failures surface immediately instead of being silently dropped.

Source

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

// Read JSONL from stdin.
export function readInput(handle) {
	const buffSize = 1024;
	let currentLine = [];
	const buffer = new Uint8Array(buffSize);

	// These are not implemented by QuickJS.
	console.warn = (value) => {
		console.log(value);
	};

	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) {

View on GitHub (pinned to 52c9bd7908)

Solutions

  1. Use console.warn or console.log instead of console.error inside warpc modules
  2. Wrap the offending call in try/catch if the condition is recoverable
  3. Strip or shim libraries that unconditionally call console.error

Example fix

// before
console.error("something went wrong");
// after
console.warn("something went wrong");
Defensive patterns

Strategy: try-catch

Try / catch

try { handle(message); } catch (e) { if (e && /Error/.test(e.message)) { reportAndContinue(e); } else throw e; }

Prevention

When it happens

Trigger: Calling console.error(value) directly inside a warpc JS module, or invoking a bundled library code path that logs via console.error while handling a JSONL message through readInput/handle.

Common situations: A bundled JS dependency calls console.error; a handler logs an error expecting it to be swallowed but it crashes the request; debugging with console.error instead of console.warn.

Related errors


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