{"record":{"id":"00ab051cf644e925","repo":"windmill-labs/windmill","slug":"vsnprintf-is-not-supported-00ab05","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-ruby/src/wasm_libc.rs","lineNumber":276,"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":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-ruby/src/wasm_libc.rs#L258-L294","documentation":"`vsnprintf` (variadic formatted print into a buffer) is another libc function the WASM Ruby parser deliberately does not implement; its `#[no_mangle]` export panics unconditionally. Formatting machinery in the Ruby VM or linked C code that reaches vsnprintf aborts here.","triggerScenarios":"Calling the exported `vsnprintf` symbol, or a code path in the VM/gems that formats strings through C stdio (`printf`-family internals).","commonSituations":"Ruby formatting (sprintf/String#%) routed into libc internals inside the wasm sandbox; typically triggered by gems with C extensions.","solutions":["Avoid C-extension gems that rely on printf-family formatting inside the parser sandbox","Use pure-Ruby formatting (String#%, String#format equivalents) which does not descend into libc","Provide a working vsnprintf shim compiled for wasm32 if such gems must be supported"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// detect C-extension dependencies that may invoke printf-family libc calls\nlet risky = manifest.dependencies.iter()\n    .any(|d| d.is_native_extension() && NATIVE_FORMAT_GEMS.contains(&d.name.as_str()));\nif risky { warn(\"gem may call unsupported libc formatting in the wasm parser\"); }","typeGuard":null,"tryCatchPattern":"std::panic::catch_unwind(|| parse_ruby(source)).unwrap_or_else(|e| {\n    Err(sandbox_unsupported_error(\"vsnprintf\", e))\n})","preventionTips":["Prefer pure-Ruby gems in parser-executed code","Avoid sprintf-heavy native gems inside the sandbox","Track which libc shims the parser implements before adding dependencies"],"tags":["wasm","ruby","libc","unsupported-operation"],"backgroundTag":"wasm-unsupported-libc-call","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"}