{"record":{"id":"27320fb4268a3a7a","repo":"windmill-labs/windmill","slug":"vsnprintf-is-not-supported-27320f","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-java/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!(\"clock_gettime is not supported\");\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-java/src/wasm_libc.rs#L172-L208","documentation":"The `vsnprintf` stub panics: formatted string rendering with varargs is not implemented in the WASM libc shim. Even though vsnprintf writes to a memory buffer (not a stream), the library chose not to implement printf-family formatting, so the symbol is link-compat only and any call is fatal.","triggerScenarios":"Code inside the WASM module calls `vsnprintf(buf, size, fmt, args)` — building formatted messages, log lines, or error strings via the printf family (often through wrappers like log_printf or error-formatters).","commonSituations":"Native components formatting diagnostics or error messages; sprintf-style helpers implemented on top of vsnprintf; string-building utilities in bundled C code.","solutions":["Replace vsnprintf usage in the compiled component with the Rust-side format!/format_args! (the shim already uses it) or a simple string builder.","Upgrade windmill-parser-java in case newer builds provide a vsnprintf implementation.","Avoid the formatted-message code path by changing the parsed input.","If the call site is a third-party dependency, propose or vendor a minimal vsnprintf implementation for the shim."],"exampleFix":"// before\nvsnprintf(buf, sizeof(buf), \"count=%d\", ap);\n\n// after: build the string without printf family\nconsole_log!(\"count={}\", count); // uses format_args! under the hood","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('vsnprintf is not supported')) {\n    throw new Error('native component used printf-family formatting; unsupported in parser WASM');\n  }\n  throw e;\n}","preventionTips":["Format messages with Rust format!/format_args! or hand-rolled builders in sandboxed code.","Grep native sources for printf-family calls before WASM builds.","Vendor a minimal vsnprintf only if a dependency truly requires it.","Watch wasm_libc.rs for upstream printf implementations and adopt them."],"tags":["wasm","libc","printf","vsnprintf","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"}