{"record":{"id":"5ff1e53887e2363f","repo":"windmill-labs/windmill","slug":"fputs-is-not-supported-5ff1e5","errorCode":null,"errorMessage":"fputs is not supported","messagePattern":"fputs is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-java/src/wasm_libc.rs","lineNumber":155,"sourceCode":"}\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]\npub unsafe extern \"C\" fn fclose(_file: *mut c_void) -> c_int {\n    panic!(\"fclose is not supported\");\n}\n\n#[no_mangle]","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-java/src/wasm_libc.rs#L137-L173","documentation":"The `fputs` stub in the WASM libc shim panics unconditionally. `fputs` writes a string to a C file stream; since the sandbox exposes no real stream objects, the library exports the symbol purely for link compatibility and treats any runtime call as an unsupported operation.","triggerScenarios":"Code inside the parser's WASM module calls `fputs(s, stream)` — typically plain-string output to stdout/stderr or to a file opened in the native component.","commonSituations":"A native/C dependency emitting unformatted output; transpiled Java/native helpers printing progress or results; code paths that open and write pseudo-files inside the sandbox.","solutions":["Remove or replace the fputs call in the code compiled into the module (use console_log! for diagnostics).","Check for a newer windmill-parser-java version where the triggering component avoids stdio.","Alter the parse input so the fputs-emitting path is not reached.","Request a stdout-shim implementation upstream if the call site is third-party and unavoidable."],"exampleFix":"// before\nfputs(\"done\\n\", stdout);\n\n// after\nconsole_log!(\"done\");","handlingStrategy":"try-catch","validationCode":"if (!input || typeof input !== 'string') throw new Error('invalid parser input');","typeGuard":null,"tryCatchPattern":"try {\n  const result = parse(input);\n} catch (e) {\n  if (String(e).includes('fputs is not supported')) {\n    throw new Error('native component attempted fputs; unsupported in parser WASM');\n  }\n  throw e;\n}","preventionTips":["Route all native output through the shim's console_log! macro.","Grep bundled C/native sources for fputs before building the WASM module.","Keep parser inputs within the constructs the supported code paths handle.","Track wasm_libc.rs stubs to know which symbols are link-only."],"tags":["wasm","libc","stdio","fputs","panic"],"backgroundTag":"wasm-libc-stub-panic","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"}