{"record":{"id":"3435207f812fd58b","repo":"windmill-labs/windmill","slug":"fputc-is-not-supported","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-csharp/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-csharp/src/wasm_libc.rs#L142-L178","documentation":"fputc() is stubbed in wasm_libc.rs and panics with \"fputc is not supported\". Character-at-a-time stream output has no counterpart in the WASM host, so the shim aborts. The panic fires as soon as any WASM code imports or calls fputc.","triggerScenarios":"The WASM-hosted runtime writes a single character to a FILE stream via fputc(c, stream) (often inside putchar/printf internals or custom writers).","commonSituations":"putchar()-based output paths in native code compiled to WASM; character-loop printing in vendored C dependencies; runtime error formatting that streams chars.","solutions":["Locate and disable the code path using fputc (e.g. disable stdio output in the runtime build).","Replace with buffered writes to the console_log shim.","Implement fputc in wasm_libc.rs to append to an in-memory buffer or console.","Recompile the dependency with stdio stripped."],"exampleFix":"// before\nfputc('x', stdout);\n// after\nconsole_log!(\"x\");","handlingStrategy":"validation","validationCode":"// Verify no character-level stdio writes are on the wasm execution path:\nif (isWasmHost && usesCharStreamOutput(code)) {\n  throw new Error(\"Code uses fputc/putchar; unsupported in the wasm C# parser.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  runInWasmParser(code);\n} catch (e) {\n  if (String(e?.message ?? e).includes(\"fputc is not supported\")) {\n    console.warn(\"fputc/putchar output is unsupported in wasm; buffer output instead.\");\n  } else {\n    throw e;\n  }\n}","preventionTips":["Replace putchar-style loops with buffered writes routed to console.","Compile native deps for wasm without char-at-a-time stdio.","Keep wasm_libc.rs stubs documented so callers know which symbols abort.","Exercise new dependencies in the wasm host in CI."],"tags":["wasm","libc","csharp","stdio","unsupported-symbol"],"backgroundTag":"unsupported-wasm-libc-symbol","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"}