windmill-labs/windmill · error
fputc is not supported
Error message
fputc is not supported
What it means
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.
Source
Thrown at backend/parsers/windmill-parser-csharp/src/wasm_libc.rs:160
pub unsafe extern "C" fn isprint(c: c_int) -> bool {
c >= 32 && c <= 126
}
/* --------------------------------- stdio.h -------------------------------- */
#[no_mangle]
pub unsafe extern "C" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {
panic!("fprintf is not supported");
}
#[no_mangle]
pub unsafe extern "C" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {
panic!("fputs is not supported");
}
#[no_mangle]
pub unsafe extern "C" fn fputc(_c: c_int, _file: *mut c_void) -> c_int {
panic!("fputc is not supported");
}
#[no_mangle]
pub unsafe extern "C" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {
panic!("fdopen is not supported");
}
#[no_mangle]
pub unsafe extern "C" fn fclose(_file: *mut c_void) -> c_int {
panic!("fclose is not supported");
}
#[no_mangle]
pub unsafe extern "C" fn fwrite(
_ptr: *const c_void,
_size: usize,
_nmemb: usize,
_stream: *mut c_void,View on GitHub (pinned to e474e8803c)
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.
Example fix
// before
fputc('x', stdout);
// after
console_log!("x"); Defensive patterns
Strategy: validation
Validate before calling
// Verify no character-level stdio writes are on the wasm execution path:
if (isWasmHost && usesCharStreamOutput(code)) {
throw new Error("Code uses fputc/putchar; unsupported in the wasm C# parser.");
} Try / catch
try {
runInWasmParser(code);
} catch (e) {
if (String(e?.message ?? e).includes("fputc is not supported")) {
console.warn("fputc/putchar output is unsupported in wasm; buffer output instead.");
} else {
throw e;
}
} Prevention
- 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.
When it happens
Trigger: The WASM-hosted runtime writes a single character to a FILE stream via fputc(c, stream) (often inside putchar/printf internals or custom writers).
Common situations: putchar()-based output paths in native code compiled to WASM; character-loop printing in vendored C dependencies; runtime error formatting that streams chars.
Related errors
- fprintf is not supported
- fputs is not supported
- fwrite is not supported
- clock is not supported
- fdopen is not supported
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/3435207f812fd58b.
Report an issue: GitHub.