{"record":{"id":"44f3d97265f12b7f","repo":"gohugoio/hugo","slug":"value","errorCode":null,"errorMessage":"${value}","messagePattern":"\\$\\{value\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"internal/warpc/js/common.js","lineNumber":13,"sourceCode":"// Read JSONL from stdin.\nexport function readInput(handle) {\n\tconst buffSize = 1024;\n\tlet currentLine = [];\n\tconst buffer = new Uint8Array(buffSize);\n\n\t// These are not implemented by QuickJS.\n\tconsole.warn = (value) => {\n\t\tconsole.log(value);\n\t};\n\n\tconsole.error = (value) => {\n\t\tthrow new Error(value);\n\t};\n\n\t// Read all the available bytes\n\twhile (true) {\n\t\t// Stdin file descriptor\n\t\tconst fd = 0;\n\t\tlet bytesRead = 0;\n\t\ttry {\n\t\t\tbytesRead = Javy.IO.readSync(fd, buffer);\n\t\t} catch (e) {\n\t\t\t// IO.readSync fails with os error 29 when stdin closes.\n\t\t\tif (e.message.includes('os error 29')) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthrow new Error('Error reading from stdin');\n\t\t}\n\n\t\tif (bytesRead < 0) {","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/internal/warpc/js/common.js#L1-L31","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use console.warn or console.log instead of console.error inside warpc modules","Wrap the offending call in try/catch if the condition is recoverable","Strip or shim libraries that unconditionally call console.error"],"exampleFix":"// before\nconsole.error(\"something went wrong\");\n// after\nconsole.warn(\"something went wrong\");","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { handle(message); } catch (e) { if (e && /Error/.test(e.message)) { reportAndContinue(e); } else throw e; }","preventionTips":["Never call console.error inside warpc JS modules; the runtime rewrites it to throw","Audit bundled dependencies for console.error calls before shipping"],"tags":["warpc","wasm","javascript","quickjs"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}