{"record":{"id":"a1f927a2581ad43e","repo":"wasmerio/wasmer","slug":"state-get-inode-at-path-for-buffers","errorCode":null,"errorMessage":"state::get_inode_at_path for buffers","messagePattern":"state::get_inode_at_path for buffers","errorType":"panic","errorClass":"panic","httpStatus":null,"severity":"error","filePath":"lib/wasix/src/fs/mod.rs","lineNumber":1346,"sourceCode":"                }\n                PosixPathComponent::Normal(component) => component,\n                PosixPathComponent::RootDir => unreachable!(\"RootDir is handled above\"),\n            };\n\n            'component_lookup: loop {\n                // 1. Read-Only Lookup Phase\n                // --\n                // Match current inode against known entry types, and if it happens\n                // to be a directory, then resolve current component as an entry in\n                // that directory.\n                // Note: this loop practically never does more than one iteration.\n                // There is only one exotic case when this loop would do another\n                // iteration, and it is when current inode happens to be Root\n                // containing '/' entry.\n                let component_resolution = {\n                    match cur_inode.clone().read().deref() {\n                        Kind::Buffer { .. } => {\n                            unimplemented!(\"state::get_inode_at_path for buffers\")\n                        }\n                        Kind::File { .. }\n                        | Kind::Socket { .. }\n                        | Kind::PipeRx { .. }\n                        | Kind::PipeTx { .. }\n                        | Kind::DuplexPipe { .. }\n                        | Kind::EventNotifications { .. }\n                        | Kind::Epoll { .. } => {\n                            return Err(Errno::Notdir);\n                        }\n                        Kind::Symlink { .. } => break 'component_lookup,\n                        Kind::Root { entries } => {\n                            if let Some(entry) = entries.get(component_str) {\n                                cur_inode = entry.clone();\n                                break 'component_lookup;\n                            } else if let Some(root) = entries.get(\"/\") {\n                                // This is quite exotic case where Root itself\n                                // has '/' entry in it, and we want to follow","sourceCodeStart":1328,"sourceCodeEnd":1364,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/fs/mod.rs#L1328-L1364","documentation":"state::get_inode_at_path resolves a path component-by-component through the in-memory FS tree. When it walks into an inode of Kind::Buffer (an in-memory buffer-backed node), the resolution logic has no implementation, so it panics with unimplemented!. Buffer nodes cannot be traversed/consulted during path lookup yet.","triggerScenarios":"Calling any WASI path API that internally resolves a path (fd_open / path_open family, stat, etc.) where an intermediate or final component of the resolved path lands on a Kind::Buffer inode — e.g. looking up a child under a buffer-backed node.","commonSituations":"Guest programs open paths inside synthetic FS trees where a driver registered a Buffer inode (preopened in-memory blobs) and the guest treats it like a directory or resolves through it; also mismatched expectations that buffers behave like regular files in path lookups.","solutions":["Do not place Kind::Buffer nodes where path resolution must traverse them; use Kind::File or a real directory-backed node instead.","Resolve to the buffer's inode directly by handle rather than by path traversal.","Pre-check the tree (inspect inode Kind before path resolution) and return Errno::Notsup / Badf for buffer nodes instead of reaching the panic.","Implement the Buffer arm in get_inode_at_path if you control the source."],"exampleFix":"// before: resolving a path through a buffer node panics\nstate.get_inode_at_path(cur_dir, \"/memfs/blob.txt\")?\n\n// after: guard the node kind first\nif matches!(&*inode.read(), Kind::Buffer { .. }) {\n    return Err(Errno::Notsup);\n}","handlingStrategy":"type-guard","validationCode":"// check inode kind before path resolution / traversal\nfn is_buffer(inode: &Inode) -> bool {\n    matches!(&*inode.read(), Kind::Buffer { .. })\n}","typeGuard":"fn as_buffer(guard: &InodeGuard) -> Option<BufferHandle> {\n    match &*guard.read() {\n        Kind::Buffer { .. } => None, // unsupported for path resolution\n        _ => Some(()),\n    }.map(|_| ())\n}","tryCatchPattern":"let result = std::panic::catch_unwind(|| state.get_inode_at_path(dir, path));\nmatch result {\n    Ok(Ok(inode)) => inode,\n    _ => return Err(Errno::Notsup),\n};","preventionTips":["Avoid registering Kind::Buffer nodes in directories guests traverse by path","Audit custom FS drivers: use Kind::File for path-openable content","Add FS-tree sanity tests that walk every registered node kind through path resolution"],"tags":["wasix","filesystem","unimplemented","buffer"],"backgroundTag":"unsupported-inode-kind","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}