windmill-labs/windmill · error

fputc is not supported

Error message

fputc is not supported

What it means

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.

Source

Thrown at backend/parsers/windmill-parser-java/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

  1. Rewrite the emitting code to buffer output and use a supported channel (console_log!) instead of per-character stream writes.
  2. Upgrade windmill-parser-java in case newer versions handle or avoid fputc.
  3. Change the input so the character-output path is not exercised.
  4. Open an upstream issue if the call originates in a dependency you cannot modify.

Example fix

// before
for (const char *p = s; *p; ++p) fputc(*p, stdout);

// after
console_log!("{}", s);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!input || typeof input !== 'string') throw new Error('invalid parser input');

Try / catch

try {
  const result = parse(input);
} catch (e) {
  if (String(e).includes('fputc is not supported')) {
    throw new Error('native component emitted per-character stream output; unsupported in parser WASM');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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