{"record":{"id":"b779d2e3f0fa2890","repo":"xai-org/grok-build","slug":"invalidinput","errorCode":"InvalidInput","errorMessage":"endpoint has no parent directory","messagePattern":"endpoint has no parent directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-sandbox/src/runtime_sockets.rs","lineNumber":94,"sourceCode":") -> io::Result<Vec<PathBuf>> {\n    match handed {\n        Ok(encoded) => decode_bwrap_runtime_socket_denies_with_policy(&encoded, allowed),\n        Err(std::env::VarError::NotPresent) => Ok(Vec::new()),\n        Err(error) => Err(io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\"invalid bwrap runtime-socket deny handoff: {error}\"),\n        )),\n    }\n}\n\n/// Missing candidates are skipped; every other resolution failure is returned.\nfn materialize_runtime_socket_deny_paths_from(\n    candidates: impl IntoIterator<Item = PathBuf>,\n) -> io::Result<Vec<PathBuf>> {\n    let mut paths = Vec::new();\n    for candidate in candidates {\n        let with_context = |error: io::Error| {\n            io::Error::new(\n                error.kind(),\n                format!(\n                    \"could not resolve runtime-socket deny path {}: {error}\",\n                    candidate.display()\n                ),\n            )\n        };\n        let parent = candidate.parent().ok_or_else(|| {\n            with_context(io::Error::new(\n                io::ErrorKind::InvalidInput,\n                \"endpoint has no parent directory\",\n            ))\n        })?;\n        let file_name = candidate.file_name().ok_or_else(|| {\n            with_context(io::Error::new(\n                io::ErrorKind::InvalidInput,\n                \"endpoint has no file name\",\n            ))","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-sandbox/src/runtime_sockets.rs#L76-L112","documentation":"`materialize_runtime_socket_deny_paths_from` resolves each candidate socket endpoint into a canonical deny path. A `Path` with no parent (a bare relative component like `foo` or `.`) cannot be split into parent + file_name, so the function wraps an `InvalidInput` error, contextualized with the failing candidate path ('could not resolve runtime-socket deny path <candidate>: endpoint has no parent directory').","triggerScenarios":"Passing a relative single-component path (e.g. `sock`, `.`, `..`) — anything where `Path::parent()` returns `None` — into `materialize_runtime_socket_deny_paths` / `materialize_runtime_socket_deny_paths_from` as a runtime-socket endpoint.","commonSituations":"Hard-coding a socket name without a directory; config with a bare socket filename; a variable that was supposed to hold an absolute path but is empty-ish or a lone `.`/`..` component.","solutions":["Pass absolute endpoints including their directory (e.g. `/run/user/1000/bus`, not `bus`)","If you only have a filename, join it with its intended directory before calling","Validate candidates with `path.parent().is_some()` and reject/handle bare names up front"],"exampleFix":"// before\nmaterialize_runtime_socket_deny_paths(vec![PathBuf::from(\"bus\")])\n// after\nmaterialize_runtime_socket_deny_paths(vec![PathBuf::from(\"/run/user/1000/bus\")])","handlingStrategy":"validation","validationCode":"fn ensure_parented(p: &std::path::Path) -> Result<(), String> {\n    if p.parent().is_none() {\n        return Err(format!(\"endpoint {} must include a directory\", p.display()));\n    }\n    Ok(())\n}","typeGuard":"fn has_parent(p: &std::path::Path) -> bool { p.parent().is_some() }","tryCatchPattern":"match materialize_runtime_socket_deny_paths(cands) {\n    Err(e) if e.kind() == io::ErrorKind::InvalidInput => eprintln!(\"bad socket endpoint: {e}\"),\n    other => other,\n}","preventionTips":["Always use absolute socket paths","Never pass bare filenames or `.`/`..` as endpoints","Join filenames onto an explicit base dir"],"tags":["io","filesystem","path-validation"],"backgroundTag":"invalid-path-input","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}