windmill-labs/windmill · error

fputs is not supported

Error message

fputs is not supported

What it means

fputs is a stub that panics in the Ruby parser WASM libc shim (wasm_libc.rs:241). The WASM guest has no stdout/stderr streams, so string output via C fputs is unsupported; the symbol is exported only so the compiled Ruby parser links. Reaching it means the interpreter attempted to write a string to a stream.

Source

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

}

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

  1. Implement fputs in wasm_libc.rs to forward the string to the console_log helper and rebuild
  2. Suppress interpreter output (warning/verbose flags of the embedded Ruby) so fputs is never reached
  3. Upgrade to a parser build that routes output instead of panicking
  4. Adjust the Ruby input to avoid provoking interpreter output

Example fix

// before
pub unsafe extern "C" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {
    panic!("fputs is not supported");
}
// after
pub unsafe extern "C" fn fputs(s: *const c_void, _file: *mut c_void) -> c_int {
    console_log!("{}", c_str_to_rust(s));
    0
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Smoke-test the parser with a small input before production use:
await rubyParser.parse('1'); // panics with fputs if the build links output paths

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: The embedded Ruby parser calls C fputs — typically printing diagnostics, warnings, or output from the interpreter while processing Ruby source.

Common situations: Ruby code that triggers interpreter warnings; parser builds wired to print errors via fputs; sandboxed runtimes lacking stdio host functions.

Related errors


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