windmill-labs/windmill · error
fputs is not supported
Error message
fputs is not supported
What it means
fputs() is a deliberate stub in wasm_libc.rs that panics with "fputs is not supported". Writing a string to a FILE* stream is impossible in the WASM parser host because no file/stream objects exist. Any call to this libc symbol instantly aborts the running code.
Source
Thrown at backend/parsers/windmill-parser-csharp/src/wasm_libc.rs:155
}
/* --------------------------------- ctype.h -------------------------------- */
#[no_mangle]
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]View on GitHub (pinned to e474e8803c)
Solutions
- Suppress the code path in the WASM runtime that writes via fputs (disable the corresponding flag/feature).
- Route the output through the console_log shim instead.
- Implement fputs in wasm_libc.rs as a no-op or console writer if the call is benign diagnostics.
- Rebuild the offending native dependency without stdio output.
Example fix
// before
fputs("hello\n", stdout);
// after
console_log!("hello"); Defensive patterns
Strategy: validation
Validate before calling
// Ensure code destined for the wasm C# parser emits no fputs-style stream writes:
if (isWasmHost) {
runtimeConfig.redirectOutput = "console"; // not stdout/stderr streams
} Type guard
function usesStreamWrites(source) {
return /\b(fputs|fprintf|fwrite|fputc)\s*\(/.test(source); // true => will panic in wasm
} Try / catch
try {
runInWasmParser(code);
} catch (e) {
if (String(e?.message ?? e).includes("fputs is not supported")) {
console.warn("fputs is unsupported in the wasm host; redirect output to the console shim.");
} else {
throw e;
}
} Prevention
- Avoid native libs that print via fputs/puts when running under wasm.
- Implement output through the console_log shim in wasm_libc.rs.
- Consider making fputs a benign no-op shim if calls are purely diagnostic.
- Test any new native dependency in the wasm parser before shipping.
When it happens
Trigger: C code or the .NET runtime compiled to WASM calls fputs(str, stream) to emit text to stdout/stderr or another stream.
Common situations: puts-style printf redirection implemented via fputs; native libraries printing status messages; runtime bootstrap code writing a banner or error string with fputs.
Related errors
- fprintf is not supported
- fputc 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/e6b03758fb48051e.
Report an issue: GitHub.