windmill-labs/windmill · error

fprintf is not supported

Error message

fprintf is not supported

What it means

fprintf() is stubbed out in the WASM libc shim for the C# parser and panics with "fprintf is not supported". The WASM environment has no FILE* streams to write to, so formatted output to a stream cannot be satisfied. Any runtime path calling fprintf aborts immediately.

Source

Thrown at backend/parsers/windmill-parser-csharp/src/wasm_libc.rs:150

/* --------------------------------- time.h --------------------------------- */

#[no_mangle]
pub unsafe extern "C" fn clock() -> u64 {
    panic!("clock is not supported");
}

/* --------------------------------- 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]

View on GitHub (pinned to e474e8803c)

Solutions

  1. Disable verbose/error output flags in the WASM runtime configuration so nothing calls fprintf.
  2. Redirect diagnostics to a supported sink (console_log in wasm_libc.rs) instead of FILE streams.
  3. Implement fprintf in wasm_libc.rs to route through the existing console log shim.
  4. Strip or recompile the native component that drags in fprintf.

Example fix

// before
fprintf(stderr, "err: %s\n", msg);
// after
console_log!("err: {}", msg); // or a supported logging shim in wasm
Defensive patterns

Strategy: validation

Validate before calling

// Disable stdio-based diagnostics before loading code into the wasm C# runtime:
if (isWasmHost) {
  runtimeConfig.verboseErrors = false;   // avoid fprintf paths
  runtimeConfig.logSink = "console";      // route output to a supported sink
}

Try / catch

try {
  runInWasmParser(code);
} catch (e) {
  if (String(e?.message ?? e).includes("fprintf is not supported")) {
    console.warn("Stream output via fprintf is unsupported in wasm; disable verbose diagnostics.");
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: The .NET/WASM runtime or embedded C code calls libc fprintf() to write formatted output to a FILE stream (error reporting, trace output, printf redirection).

Common situations: Native C dependencies compiled into the WASM module that fprintf diagnostics; mono's crash/assert paths writing to stderr; enabling verbose runtime flags that route logging through fprintf.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/07e876863503ebc3. Report an issue: GitHub.