{"record":{"id":"e6b03758fb48051e","repo":"windmill-labs/windmill","slug":"fputs-is-not-supported","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-csharp/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-csharp/src/wasm_libc.rs#L137-L173","documentation":"fputs() is a deliberate stub in wasm_libc.rs that panics with \"fputs is not supported\". Writing a string to a FILE* stream is impossible in the WASM parser host because no file/stream objects exist. Any call to this libc symbol instantly aborts the running code.","triggerScenarios":"C code or the .NET runtime compiled to WASM calls fputs(str, stream) to emit text to stdout/stderr or another stream.","commonSituations":"puts-style printf redirection implemented via fputs; native libraries printing status messages; runtime bootstrap code writing a banner or error string with fputs.","solutions":["Suppress the code path in the WASM runtime that writes via fputs (disable the corresponding flag/feature).","Route the output through the console_log shim instead.","Implement fputs in wasm_libc.rs as a no-op or console writer if the call is benign diagnostics.","Rebuild the offending native dependency without stdio output."],"exampleFix":"// before\nfputs(\"hello\\n\", stdout);\n// after\nconsole_log!(\"hello\");","handlingStrategy":"validation","validationCode":"// Ensure code destined for the wasm C# parser emits no fputs-style stream writes:\nif (isWasmHost) {\n  runtimeConfig.redirectOutput = \"console\"; // not stdout/stderr streams\n}","typeGuard":"function usesStreamWrites(source) {\n  return /\\b(fputs|fprintf|fwrite|fputc)\\s*\\(/.test(source); // true => will panic in wasm\n}","tryCatchPattern":"try {\n  runInWasmParser(code);\n} catch (e) {\n  if (String(e?.message ?? e).includes(\"fputs is not supported\")) {\n    console.warn(\"fputs is unsupported in the wasm host; redirect output to the console shim.\");\n  } else {\n    throw e;\n  }\n}","preventionTips":["Avoid native libs that print via fputs/puts when running under wasm.","Implement output through the console_log shim in wasm_libc.rs.","Consider making fputs a benign no-op shim if calls are purely diagnostic.","Test any new native dependency in the wasm parser before shipping."],"tags":["wasm","libc","csharp","stdio","unsupported-symbol"],"backgroundTag":"unsupported-wasm-libc-symbol","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"}