{"record":{"id":"52fd06e72d4bf264","repo":"windmill-labs/windmill","slug":"fdopen-is-not-supported-52fd06","errorCode":null,"errorMessage":"fdopen is not supported","messagePattern":"fdopen is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-ruby/src/wasm_libc.rs","lineNumber":251,"sourceCode":"\n#[no_mangle]\npub unsafe extern \"C\" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {\n    panic!(\"fprintf is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {\n    panic!(\"fputs is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputc(_c: c_int, _file: *mut c_void) -> c_int {\n    panic!(\"fputc is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {\n    panic!(\"fdopen is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fclose(_file: *mut c_void) -> c_int {\n    panic!(\"fclose is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fwrite(\n    _ptr: *const c_void,\n    _size: usize,\n    _nmemb: usize,\n    _stream: *mut c_void,\n) -> usize {\n    panic!(\"fwrite is not supported\");\n}\n\n#[no_mangle]","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-ruby/src/wasm_libc.rs#L233-L269","documentation":"fdopen is unimplemented in the Ruby parser WASM libc shim (wasm_libc.rs:251) and panics on call. Opening a file descriptor as a FILE* stream is meaningless inside the WASM sandbox — there is no filesystem — so the symbol is exported purely for link compatibility. Reaching it means the interpreter attempted to open a real I/O stream.","triggerScenarios":"The embedded Ruby parser calls C fdopen to wrap a file descriptor into a FILE*, e.g. when its runtime tries to open or wrap an I/O resource during parsing/initialization.","commonSituations":"Ruby parser builds whose runtime touches file descriptors; sandboxed/browser WASM with no filesystem host bindings; a dependency change that newly links fdopen.","solutions":["Ensure the parsed code path does not require file I/O — the parser sandbox supports none","Implement fdopen in wasm_libc.rs as a stub returning a null FILE* (letting the caller handle failure) instead of panicking, then rebuild","Upgrade windmill-parser-ruby to a version that handles missing file I/O gracefully","Report the triggering input/backtrace upstream if fdopen should never be reached during parsing"],"exampleFix":"// before\npub unsafe extern \"C\" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {\n    panic!(\"fdopen is not supported\");\n}\n// after\npub unsafe extern \"C\" fn fdopen(_fd: c_int, _mode: *const c_void) -> *mut c_void {\n    std::ptr::null_mut() // no filesystem in WASM; signal failure to the caller\n}","handlingStrategy":"try-catch","validationCode":"// Reject inputs that plausibly require file I/O before parsing:\nif (/File\\.(open|new)|IO\\.open|open\\(/.test(rubySource)) {\n  console.warn('input references file I/O; parser sandbox has no filesystem');\n}","typeGuard":"function isFdopenPanic(e) {\n  return e instanceof Error && e.message.includes('fdopen is not supported');\n}","tryCatchPattern":"try {\n  const ast = rubyParser.parse(rubySource);\n} catch (e) {\n  if (isFdopenPanic(e)) {\n    return { ok: false, reason: 'file-io-unsupported-in-sandbox' };\n  }\n  throw e;\n}","preventionTips":["Remember the parser sandbox has no filesystem — never feed code paths that need file descriptors","Stub fdopen to return null so guest code can handle the failure gracefully","Upgrade parser builds that should never reach fdopen during pure parsing","Capture backtraces to find which runtime code opens streams"],"tags":["wasm","rust","libc","io","ruby"],"backgroundTag":"wasm-libc-function-not-supported","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}