windmill-labs/windmill · error
oh no
Error message
oh no
What it means
__assert_fail in the windmill-parser-java WASM libc shim is a stub that panics with the unhelpful message "oh no". In real libc, __assert_fail is invoked when a C assert() macro fails; here it means the compiled tree-sitter C code hit a failed assertion at runtime. The stub ignores the assertion message, file, line and function arguments (typed as *const i32), so the real cause is lost.
Source
Thrown at backend/parsers/windmill-parser-java/src/wasm_libc.rs:206
_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
- Improve the stub to surface diagnostics first: read the assert message/file/line pointers and include them in the panic, so you know which assertion failed.
- Reproduce with the same input document and check whether the input is malformed, truncated, or not valid UTF-8/ASCII where the scanner expects it.
- Audit the other libc stubs: a prior panic or bogus return value from fprintf/snprintf/fwrite stubs can corrupt state that later trips an assert — fix the root stub, not just the assert.
- Pin or upgrade the tree-sitter-java grammar version to one known to run cleanly under the WASM shim set.
Example fix
// before (wasm_libc.rs)
#[no_mangle]
pub extern "C" fn __assert_fail(_: *const i32, _: *const i32, _: *const i32, _: *const i32) {
panic!("oh no");
}
// after — surface the real assertion message
#[no_mangle]
pub unsafe extern "C" fn __assert_fail(
assertion: *const c_char,
file: *const c_char,
line: c_int,
_func: *const c_char,
) {
let msg = if assertion.is_null() { "?" } else { std::ffi::CStr::from_ptr(assertion).to_string_lossy().into_owned() };
let f = if file.is_null() { "?" } else { std::ffi::CStr::from_ptr(file).to_string_lossy().into_owned() };
panic!("assertion failed: {} ({}:{})", msg, f, line);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check input shape before handing it to the parser to reduce
// odds of driving the scanner into assertion territory:
function validateJavaDoc(doc) {
if (typeof doc !== 'string') return false;
// reject NUL bytes / obviously truncated content that scanners choke on
return !doc.includes('\u0000');
} Type guard
function isStringDoc(doc) {
return typeof doc === 'string' && !doc.includes('\u0000');
} Try / catch
let result;
try {
result = parser.parse(doc);
} catch (e) {
if (String(e).includes('oh no')) {
// assertion failed in C code; message is opaque — recreate parser,
// log the offending document for reproduction, and skip/queue it
parser = new Parser();
quarantine(doc);
} else {
throw e;
}
} Prevention
- Improve the __assert_fail shim to include the assertion text and file:line so failures are diagnosable — an opaque "oh no" makes every incident a guessing game.
- Sanitize inputs (strip NUL bytes, ensure well-formed text) before parsing.
- Keep parser instances per-request/per-worker; never reuse one that panicked.
- Upgrade the shim plus grammar together; mismatches between scanner ABI and runtime surface as assertions.
When it happens
Trigger: C code inside the WASM parser (tree-sitter runtime or a custom scanner) evaluates assert(expr) with a false expression, causing the linker to call __assert_fail, which unconditionally panics with "oh no".
Common situations: Malformed or truncated input that drives the scanner into an invalid state; a corrupted/misaligned pointer caused by another shim bug (e.g. the layout-prepended allocator or a stubbed stdio function returning garbage); a grammar version whose assertions no longer hold in the sandboxed environment.
Related errors
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/114b532b9915ef65.
Report an issue: GitHub.