windmill-labs/windmill · error

fprintf is not supported

Error message

fprintf is not supported

What it means

fprintf is unimplemented in the Ruby parser WASM libc shim (wasm_libc.rs:236) and panics when called. There is no real filesystem or stdout stream behind the WASM guest, so all C stdio output functions were stubbed out; fprintf reaching execution means the compiled Ruby parser tried to write formatted output to a FILE*.

Source

Thrown at backend/parsers/windmill-parser-ruby/src/wasm_libc.rs:236

/* --------------------------------- 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. Redirect the interpreter's error/warning output away from stdio (configure the embedded Ruby's verbose/warning settings) or route it to the shim's console_log macro
  2. Implement fprintf in wasm_libc.rs to forward formatted text to console log and rebuild the WASM parser
  3. Upgrade windmill-parser-ruby for a build whose diagnostics don't hit fprintf
  4. Change the Ruby input that provokes the diagnostic message

Example fix

// before
pub unsafe extern "C" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {
    panic!("fprintf is not supported");
}
// after: forward to console instead of aborting the parser
pub unsafe extern "C" fn fprintf(_file: *mut c_void, format: *const c_void) -> c_int {
    console_log!("fprintf: {}", c_str_to_rust(format));
    0
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Prefer inputs unlikely to trigger interpreter diagnostics:
if (/warn|puts|print/.test(rubySource)) console.warn('input may provoke interpreter output paths');

Type guard

function isFprintfPanic(e) {
  return e instanceof Error && e.message.includes('fprintf is not supported');
}

Try / catch

try {
  const ast = rubyParser.parse(rubySource);
} catch (e) {
  if (isFprintfPanic(e)) {
    return fallbackParse(rubySource);
  }
  throw e;
}

Prevention

When it happens

Trigger: The embedded Ruby interpreter calls C fprintf — error message emission, warning output, or trace/debug printing during parsing of a Ruby script.

Common situations: Ruby syntax that makes the interpreter emit a C-level warning/error message; parser builds whose error paths print via fprintf; running the parser in a sandbox with no stdio bindings.

Related errors


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