{"record":{"id":"001b4da6e750e0be","repo":"windmill-labs/windmill","slug":"fputc-is-not-supported-001b4d","errorCode":null,"errorMessage":"fputc is not supported","messagePattern":"fputc is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-java/src/wasm_libc.rs","lineNumber":160,"sourceCode":"pub 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]\npub unsafe extern \"C\" fn fclose(_file: *mut c_void) -> c_int {\n    panic!(\"fclose is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fwrite(\n    _ptr: *const c_void,\n    _size: usize,\n    _nmemb: usize,\n    _stream: *mut c_void,","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-java/src/wasm_libc.rs#L142-L178","documentation":"The `fputc` libc stub panics unconditionally: single-character stream output is not implemented in the WASM libc shim. The symbol exists only to satisfy the linker for C code compiled into the Java parser module; calling it at runtime is unsupported and fatal.","triggerScenarios":"Code in the WASM module calls `fputc(c, stream)` — e.g. character-by-character output loops, emitting a byte to stdout/stderr or a pseudo-file stream.","commonSituations":"Native components that write output one char at a time; hand-rolled serializers or printers in bundled C code; lexer/printer utilities inside the transpiled parsing stack.","solutions":["Rewrite the emitting code to buffer output and use a supported channel (console_log!) instead of per-character stream writes.","Upgrade windmill-parser-java in case newer versions handle or avoid fputc.","Change the input so the character-output path is not exercised.","Open an upstream issue if the call originates in a dependency you cannot modify."],"exampleFix":"// before\nfor (const char *p = s; *p; ++p) fputc(*p, stdout);\n\n// after\nconsole_log!(\"{}\", s);","handlingStrategy":"try-catch","validationCode":"if (!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('fputc is not supported')) {\n    throw new Error('native component emitted per-character stream output; unsupported in parser WASM');\n  }\n  throw e;\n}","preventionTips":["Replace per-character stream emission with buffered output in native components.","Audit dependencies for fputc/fwrite loops before WASM builds.","Prefer host-provided output channels over stdio in sandboxed code.","Add parse smoke tests covering output-heavy inputs."],"tags":["wasm","libc","stdio","fputc","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-08T15:18:49.778Z"}