{"record":{"id":"791a447200e346b4","repo":"windmill-labs/windmill","slug":"fprintf-is-not-supported-791a44","errorCode":null,"errorMessage":"fprintf is not supported","messagePattern":"fprintf is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-ruby/src/wasm_libc.rs","lineNumber":236,"sourceCode":"/* --------------------------------- time.h --------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn clock() -> u64 {\n    panic!(\"clock is not supported\");\n}\n\n/* --------------------------------- ctype.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn isprint(c: c_int) -> bool {\n    c >= 32 && c <= 126\n}\n\n/* --------------------------------- stdio.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {\n    panic!(\"fprintf is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {\n    panic!(\"fputs is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputc(_c: c_int, _file: *mut c_void) -> c_int {\n    panic!(\"fputc is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {\n    panic!(\"fdopen is not supported\");\n}\n\n#[no_mangle]","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-ruby/src/wasm_libc.rs#L218-L254","documentation":"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*.","triggerScenarios":"The embedded Ruby interpreter calls C fprintf — error message emission, warning output, or trace/debug printing during parsing of a Ruby script.","commonSituations":"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.","solutions":["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","Implement fprintf in wasm_libc.rs to forward formatted text to console log and rebuild the WASM parser","Upgrade windmill-parser-ruby for a build whose diagnostics don't hit fprintf","Change the Ruby input that provokes the diagnostic message"],"exampleFix":"// before\npub unsafe extern \"C\" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {\n    panic!(\"fprintf is not supported\");\n}\n// after: forward to console instead of aborting the parser\npub unsafe extern \"C\" fn fprintf(_file: *mut c_void, format: *const c_void) -> c_int {\n    console_log!(\"fprintf: {}\", c_str_to_rust(format));\n    0\n}","handlingStrategy":"try-catch","validationCode":"// Prefer inputs unlikely to trigger interpreter diagnostics:\nif (/warn|puts|print/.test(rubySource)) console.warn('input may provoke interpreter output paths');","typeGuard":"function isFprintfPanic(e) {\n  return e instanceof Error && e.message.includes('fprintf is not supported');\n}","tryCatchPattern":"try {\n  const ast = rubyParser.parse(rubySource);\n} catch (e) {\n  if (isFprintfPanic(e)) {\n    return fallbackParse(rubySource);\n  }\n  throw e;\n}","preventionTips":["Route guest diagnostics to console_log by implementing fprintf in the shim","Silence interpreter warnings/verbose output before parsing","Catch every parse call — stdio panics abort the whole parse operation","Check the WASM backtrace to learn which diagnostic path calls fprintf"],"tags":["wasm","rust","libc","stdio","ruby"],"backgroundTag":"wasm-libc-function-not-supported","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}