{"record":{"id":"96e370d3c60002c1","repo":"zed-industries/zed","slug":"cannot-write-to-path-resolved","errorCode":null,"errorMessage":"cannot write to path {resolved:?}","messagePattern":"cannot write to path (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/extension_host/src/wasm_host.rs","lineNumber":808,"sourceCode":"        let mut existing = normalized.as_path();\n        let mut tail_components = Vec::new();\n        let canonical_prefix = loop {\n            match self.fs.canonicalize(existing).await {\n                Ok(canonical) => break canonical,\n                Err(_) => {\n                    if let Some(file_name) = existing.file_name() {\n                        tail_components.push(file_name.to_owned());\n                    }\n                    existing = existing\n                        .parent()\n                        .context(format!(\"cannot resolve path {path:?}\"))?;\n                }\n            }\n        };\n\n        let mut resolved = canonical_prefix;\n        for component in tail_components.into_iter().rev() {\n            resolved.push(component);\n        }\n\n        anyhow::ensure!(\n            resolved.starts_with(&extension_work_dir),\n            \"cannot write to path {resolved:?}\",\n        );\n        Ok(resolved)\n    }\n}\n\npub fn parse_wasm_extension_version(extension_id: &str, wasm_bytes: &[u8]) -> Result<Version> {\n    let mut version = None;\n\n    for part in wasmparser::Parser::new(0).parse_all(wasm_bytes) {\n        if let wasmparser::Payload::CustomSection(s) =\n            part.context(\"error parsing wasm extension\")?\n            && s.name() == \"zed:api-version\"\n        {","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/extension_host/src/wasm_host.rs#L790-L826","documentation":"writeable_path_from_extension cannot produce a writable location for {resolved}: the canonicalization walk (walking parents until an existing ancestor canonicalizes) combined with tail components yielded a path that fails the final writability/containment check. Typically the resolved path is outside the extension work dir or on a read-only/missing parent, so the write is refused.","triggerScenarios":"Thrown at crates/extension_host/src/wasm_host.rs:799 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure every parent directory of the target exists (create the work dir first) before writing","Keep the requested path inside the extension's work directory and avoid symlinks pointing outside it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}