{"record":{"id":"07e876863503ebc3","repo":"windmill-labs/windmill","slug":"fprintf-is-not-supported","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-csharp/src/wasm_libc.rs","lineNumber":150,"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":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-csharp/src/wasm_libc.rs#L132-L168","documentation":"fprintf() is stubbed out in the WASM libc shim for the C# parser and panics with \"fprintf is not supported\". The WASM environment has no FILE* streams to write to, so formatted output to a stream cannot be satisfied. Any runtime path calling fprintf aborts immediately.","triggerScenarios":"The .NET/WASM runtime or embedded C code calls libc fprintf() to write formatted output to a FILE stream (error reporting, trace output, printf redirection).","commonSituations":"Native C dependencies compiled into the WASM module that fprintf diagnostics; mono's crash/assert paths writing to stderr; enabling verbose runtime flags that route logging through fprintf.","solutions":["Disable verbose/error output flags in the WASM runtime configuration so nothing calls fprintf.","Redirect diagnostics to a supported sink (console_log in wasm_libc.rs) instead of FILE streams.","Implement fprintf in wasm_libc.rs to route through the existing console log shim.","Strip or recompile the native component that drags in fprintf."],"exampleFix":"// before\nfprintf(stderr, \"err: %s\\n\", msg);\n// after\nconsole_log!(\"err: {}\", msg); // or a supported logging shim in wasm","handlingStrategy":"validation","validationCode":"// Disable stdio-based diagnostics before loading code into the wasm C# runtime:\nif (isWasmHost) {\n  runtimeConfig.verboseErrors = false;   // avoid fprintf paths\n  runtimeConfig.logSink = \"console\";      // route output to a supported sink\n}","typeGuard":null,"tryCatchPattern":"try {\n  runInWasmParser(code);\n} catch (e) {\n  if (String(e?.message ?? e).includes(\"fprintf is not supported\")) {\n    console.warn(\"Stream output via fprintf is unsupported in wasm; disable verbose diagnostics.\");\n  } else {\n    throw e;\n  }\n}","preventionTips":["Do not enable verbose/error tracing flags in the wasm runtime.","Route all output through console shims, not FILE streams.","Compile native dependencies for wasm with stdio output stripped.","Keep the libc shim list of unsupported symbols documented for contributors."],"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"}