{"record":{"id":"93fa8996accb54dc","repo":"windmill-labs/windmill","slug":"vsnprintf-is-not-supported","errorCode":null,"errorMessage":"vsnprintf is not supported","messagePattern":"vsnprintf is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-csharp/src/wasm_libc.rs","lineNumber":190,"sourceCode":"\n#[no_mangle]\npub unsafe extern \"C\" fn fwrite(\n    _ptr: *const c_void,\n    _size: usize,\n    _nmemb: usize,\n    _stream: *mut c_void,\n) -> usize {\n    panic!(\"fwrite is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn vsnprintf(\n    _buf: *mut c_char,\n    _size: usize,\n    _format: *const c_char,\n    _args: ...\n) -> c_int {\n    panic!(\"vsnprintf is not supported\");\n}\n\n#[no_mangle]\npub extern \"C\" fn clock_gettime(ptr: usize, new_size: usize) {\n    panic!(\"asdasd\");\n}\n\n// int snprintf( char* restrict buffer, size_t bufsz, const char* restrict format, ... );\n#[no_mangle]\npub extern \"C\" fn snprintf() {\n    panic!(\"snprintf is not supported\");\n}\n\n#[no_mangle]\npub extern \"C\" fn __assert_fail(_: *const i32, _: *const i32, _: *const i32, _: *const i32) {\n    panic!(\"oh no\");\n}\n","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-csharp/src/wasm_libc.rs#L172-L208","documentation":"vsnprintf() is a stub that panics with \"vsnprintf is not supported\" in wasm_libc.rs. Formatted printing into a caller buffer via a va_list is unimplemented in the WASM shim, so any runtime path that formats into a buffer aborts. (Note the adjacent clock_gettime stub also panics with the nonsense string \"asdasd\", indicating this shim area is rough.)","triggerScenarios":"Code calls vsnprintf(buf, size, format, args) — typically via vsnprintf-based logging wrappers or vasprintf-style helpers — inside the WASM runtime.","commonSituations":"Logging frameworks built on vprintf/vsnprintf in native deps; error-message formatting in C glue code; a runtime version change that newly pulls vsnprintf into the import list.","solutions":["Disable the logging/formatting path that uses vsnprintf in the WASM build.","Implement vsnprintf in wasm_libc.rs supporting the subset of format specifiers actually used.","Replace with a Rust-side formatter (format_args!) before crossing into libc.","Pin/choose a runtime build whose formatting avoids vsnprintf imports."],"exampleFix":"// before\nvsnprintf(buf, sizeof(buf), fmt, args);\n// after\nlet s = format!(\"{}\", format_args_line(fmt, args)); // Rust-side formatting\nbuf.copy_from_slice(s.as_bytes());","handlingStrategy":"validation","validationCode":"// Reject code paths that format via vsnprintf when targeting wasm:\nif (isWasmHost && usesVsnprintf(nativeDeps)) {\n  throw new Error(\"Dependency formats with vsnprintf; unsupported in the wasm C# parser.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  runInWasmParser(code);\n} catch (e) {\n  if (String(e?.message ?? e).includes(\"vsnprintf is not supported\")) {\n    console.warn(\"vsnprintf is unimplemented in the wasm shim; format on the managed side.\");\n  } else {\n    throw e;\n  }\n}","preventionTips":["Format strings with managed .NET APIs instead of libc printf family in wasm.","Implement a minimal vsnprintf in wasm_libc.rs if a small specifier subset suffices.","Watch runtime upgrades for new libc imports (snprintf/vsnprintf) and test them.","Prefer Rust-side format_args! helpers when writing glue for the wasm host."],"tags":["wasm","libc","csharp","printf","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"}