windmill-labs/windmill · error

vsnprintf is not supported

Error message

vsnprintf is not supported

What it means

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.)

Source

Thrown at backend/parsers/windmill-parser-csharp/src/wasm_libc.rs:190

#[no_mangle]
pub unsafe extern "C" fn fwrite(
    _ptr: *const c_void,
    _size: usize,
    _nmemb: usize,
    _stream: *mut c_void,
) -> usize {
    panic!("fwrite is not supported");
}

#[no_mangle]
pub unsafe extern "C" fn vsnprintf(
    _buf: *mut c_char,
    _size: usize,
    _format: *const c_char,
    _args: ...
) -> c_int {
    panic!("vsnprintf is not supported");
}

#[no_mangle]
pub extern "C" fn clock_gettime(ptr: usize, new_size: usize) {
    panic!("asdasd");
}

// int snprintf( char* restrict buffer, size_t bufsz, const char* restrict format, ... );
#[no_mangle]
pub extern "C" fn snprintf() {
    panic!("snprintf is not supported");
}

#[no_mangle]
pub extern "C" fn __assert_fail(_: *const i32, _: *const i32, _: *const i32, _: *const i32) {
    panic!("oh no");
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Disable the logging/formatting path that uses vsnprintf in the WASM build.
  2. Implement vsnprintf in wasm_libc.rs supporting the subset of format specifiers actually used.
  3. Replace with a Rust-side formatter (format_args!) before crossing into libc.
  4. Pin/choose a runtime build whose formatting avoids vsnprintf imports.

Example fix

// before
vsnprintf(buf, sizeof(buf), fmt, args);
// after
let s = format!("{}", format_args_line(fmt, args)); // Rust-side formatting
buf.copy_from_slice(s.as_bytes());
Defensive patterns

Strategy: validation

Validate before calling

// Reject code paths that format via vsnprintf when targeting wasm:
if (isWasmHost && usesVsnprintf(nativeDeps)) {
  throw new Error("Dependency formats with vsnprintf; unsupported in the wasm C# parser.");
}

Try / catch

try {
  runInWasmParser(code);
} catch (e) {
  if (String(e?.message ?? e).includes("vsnprintf is not supported")) {
    console.warn("vsnprintf is unimplemented in the wasm shim; format on the managed side.");
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Code calls vsnprintf(buf, size, format, args) — typically via vsnprintf-based logging wrappers or vasprintf-style helpers — inside the WASM runtime.

Common situations: 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.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/93fa8996accb54dc. Report an issue: GitHub.