windmill-labs/windmill · error

snprintf is not supported

Error message

snprintf is not supported

What it means

Stub in the R parser WASM libc shim (wasm_libc.rs:287). snprintf takes no real arguments here and always panics, meaning formatted string building in C is unsupported inside this WASM parser. The symbol is exported only so the compiled parser links successfully.

Source

Thrown at backend/parsers/windmill-parser-r/src/wasm_libc.rs:287

#[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!("clock_gettime is not supported");
}

// 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. Implement snprintf in wasm_libc.rs (format via Rust and copy into the buffer) and rebuild the parser WASM
  2. Upgrade windmill-parser-r to a build that supports or avoids snprintf
  3. Change the R input so the parser never reaches the snprintf call site
  4. File the triggering snippet upstream with a backtrace to get the symbol implemented

Example fix

// before
pub extern "C" fn snprintf() {
    panic!("snprintf is not supported");
}
// after: bounded no-op that reports truncation instead of aborting
pub unsafe extern "C" fn snprintf(buf: *mut c_char, _bufsz: usize, _format: *const c_char) -> c_int {
    if !buf.is_null() { *buf = 0 as c_char; }
    0
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Smoke-test the parser with a representative input before batch use:
await rParser.parse(sampleRSource); // if this panics with snprintf, skip batch parsing

Type guard

function isSnprintfPanic(e) {
  return e instanceof Error && e.message.includes('snprintf is not supported');
}

Try / catch

try {
  const ast = rParser.parse(rSource);
} catch (e) {
  if (isSnprintfPanic(e)) {
    return { ok: false, reason: 'unsupported-formatting-path' };
  }
  throw e;
}

Prevention

When it happens

Trigger: The compiled R parser runtime calls C snprintf (bounded formatted output), e.g. when constructing messages or names during parsing.

Common situations: Parser versions whose code paths format strings in C; parsing inputs that steer the runtime into message-building branches; missing host stdio bindings in the WASM environment.

Related errors


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