windmill-labs/windmill · error

snprintf is not supported

Error message

snprintf is not supported

What it means

snprintf() is stubbed in wasm_libc.rs as a zero-argument function that panics with "snprintf is not supported". Because the stub takes no parameters, ANY snprintf call signature links to it and then aborts at runtime. Formatted string building through snprintf is therefore unsupported in the WASM host.

Source

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

#[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. Remove or bypass the code path calling snprintf in the WASM build.
  2. Implement a real snprintf in wasm_libc.rs (write at most size-1 bytes plus NUL, return would-be length).
  3. Replace calls with a supported formatter (Rust format_args! or a wasm-supported vsnprintf).
  4. Update the runtime so formatting goes through managed .NET APIs rather than libc snprintf.

Example fix

// before
snprintf(buf, sizeof(buf), "val=%d", v);
// after
let s = format!("val={}", v); // then copy into buf
Defensive patterns

Strategy: validation

Validate before calling

// Detect snprintf usage in code/dependencies bound for the wasm C# parser:
if (isWasmHost && /\bsnprintf\s*\(/.test(nativeSource)) {
  throw new Error("snprintf is not linked to a working shim in the wasm parser host.");
}

Type guard

function usesSnprintf(source) {
  return /\bsnprintf\s*\(/.test(source); // true => will panic in the wasm host
}

Try / catch

try {
  runInWasmParser(code);
} catch (e) {
  if (String(e?.message ?? e).includes("snprintf is not supported")) {
    console.warn("snprintf is unsupported in wasm; use managed formatting.");
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Any WASM-runtime code path calling snprintf(buffer, bufsz, format, ...) — usually error-message construction or string formatting in native/C-glue code.

Common situations: String building in vendored C deps; assert/diagnostic message formatting; a runtime or library upgrade that newly imports snprintf.

Related errors


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