{"record":{"id":"c108aabe5717c44c","repo":"windmill-labs/windmill","slug":"fprintf-is-not-supported-c108aa","errorCode":null,"errorMessage":"fprintf is not supported","messagePattern":"fprintf is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-java/src/wasm_libc.rs","lineNumber":150,"sourceCode":"/* --------------------------------- time.h --------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn clock() -> u64 {\n    panic!(\"clock is not supported\");\n}\n\n/* --------------------------------- ctype.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn isprint(c: c_int) -> bool {\n    c >= 32 && c <= 126\n}\n\n/* --------------------------------- stdio.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {\n    panic!(\"fprintf is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {\n    panic!(\"fputs is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputc(_c: c_int, _file: *mut c_void) -> c_int {\n    panic!(\"fputc is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {\n    panic!(\"fdopen is not supported\");\n}\n\n#[no_mangle]","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-java/src/wasm_libc.rs#L132-L168","documentation":"The `fprintf` libc stub panics because stdio output is not implemented in the WASM libc shim of the Java parser. The symbol is exported only so linkage succeeds; any call to formatted file-stream output at runtime is a hard failure, since there are no real file streams inside the sandbox.","triggerScenarios":"Code compiled into the WASM module calls `fprintf(stream, fmt, ...)` (including fprintf(stderr, ...) for diagnostics or fprintf(stdout, ...) for logging).","commonSituations":"A bundled native/C component writing diagnostics or errors to stderr; transpiled code emitting formatted logs; parsing inputs whose handling path includes C-level printf-style reporting.","solutions":["Find and remove/redirect the fprintf call in the code compiled into the module (route diagnostics through a supported channel such as console_log).","Upgrade windmill-parser-java to check whether newer builds handle or route stdio output.","Adjust parsing inputs to avoid the code path that emits C stdio output.","File an issue requesting a stdout/stderr forwarding implementation if the call is from a third-party component you cannot change."],"exampleFix":"// before\nfprintf(stderr, \"parse failed: %s\\n\", msg);\n\n// after: use the shim's console_log macro instead of stdio\nconsole_log!(\"parse failed: {}\", msg);","handlingStrategy":"try-catch","validationCode":"// Validate input reaches no diagnostics-heavy native path: pre-scan for constructs known to emit C-level output.\nif (!input || typeof input !== 'string') throw new Error('invalid parser input');","typeGuard":null,"tryCatchPattern":"try {\n  const result = parse(input);\n} catch (e) {\n  if (String(e).includes('fprintf is not supported')) {\n    throw new Error('native component attempted stdio output; unsupported in parser WASM');\n  }\n  throw e;\n}","preventionTips":["Ensure components compiled into the module use console_log! or host callbacks, never stdio.","Review native dependency code for fprintf/stderr usage before building the WASM artifact.","Add a CI smoke test parsing representative inputs to catch stdio paths early.","Upgrade the parser package when stdio shims land upstream."],"tags":["wasm","libc","stdio","fprintf","panic"],"backgroundTag":"wasm-libc-stub-panic","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}