windmill-labs/windmill · error
fwrite is not supported
Error message
fwrite is not supported
What it means
The `fwrite` stub panics: binary block writes to a C stream are not implemented in the WASM libc shim. The symbol is exported for link compatibility only; any runtime call means the code is attempting to write data out through stdio, which the sandbox cannot do.
Source
Thrown at backend/parsers/windmill-parser-java/src/wasm_libc.rs:180
#[no_mangle]
pub unsafe extern "C" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {
panic!("fdopen is not supported");
}
#[no_mangle]
pub unsafe extern "C" fn fclose(_file: *mut c_void) -> c_int {
panic!("fclose is not supported");
}
#[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!("clock_gettime is not supported");
}
// int snprintf( char* restrict buffer, size_t bufsz, const char* restrict format, ... );View on GitHub (pinned to e474e8803c)
Solutions
- Replace the fwrite path with writes into a WASM-accessible memory buffer or a supported output channel.
- Upgrade windmill-parser-java in case newer versions route output differently.
- Adjust the parse input so the buffer-writing path is not reached.
- Request a memory-backed stdio implementation upstream if the call site is a fixed dependency.
Example fix
// before fwrite(out_buf, 1, out_len, stdout); // after: return the buffer to the host instead of writing to a stream set_result_buffer(out_buf, out_len); // exposed via wasm-bindgen
Defensive patterns
Strategy: try-catch
Validate before calling
if (!input || typeof input !== 'string') throw new Error('invalid parser input'); Try / catch
try {
const result = parse(input);
} catch (e) {
if (String(e).includes('fwrite is not supported')) {
throw new Error('native component attempted buffered stream write; unsupported in parser WASM');
}
throw e;
} Prevention
- Return results via memory buffers or wasm-bindgen exports instead of stream writes.
- Audit native serializers for fwrite before building the WASM artifact.
- Keep output paths in the host, not inside the sandbox.
- Add regression tests that exercise output-producing parse paths.
When it happens
Trigger: Code compiled into the parser's WASM module calls `fwrite(ptr, size, nmemb, stream)` — serializing results, dumping buffers, or writing parsed output to a file/stdout.
Common situations: Native serializers writing output blocks; debug dump routines in bundled components; transpiled code persisting intermediate data to temp files.
Related errors
- fprintf is not supported
- fputs is not supported
- fputc is not supported
- fprintf is not supported
- fputs is not supported
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/2d373757b181b4e7.
Report an issue: GitHub.