{"record":{"id":"c0af601b2222bdad","repo":"zed-industries/zed","slug":"extension-dir-extension-dir-is-not-an-absolute-path","errorCode":null,"errorMessage":"extension dir {extension_dir:?} is not an absolute path","messagePattern":"extension dir (.+?) is not an absolute path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/extension/src/extension_builder.rs","lineNumber":102,"sourceCode":"    pub fn new(http_client: Arc<dyn HttpClient>, cache_dir: PathBuf) -> Self {\n        Self {\n            cache_dir,\n            http: http_client,\n        }\n    }\n\n    pub async fn compile_extension(\n        &self,\n        extension_dir: &Path,\n        extension_manifest: &mut ExtensionManifest,\n        options: CompileExtensionOptions,\n        fs: Arc<dyn Fs>,\n    ) -> Result<()> {\n        let start = std::time::Instant::now();\n\n        populate_defaults(extension_manifest, extension_dir, fs.clone()).await?;\n\n        anyhow::ensure!(\n            extension_dir.is_absolute(),\n            \"extension dir {extension_dir:?} is not an absolute path\"\n        );\n\n        fs.create_dir(&self.cache_dir)\n            .await\n            .context(\"creating cache directory\")?;\n\n        let (tx, mut rx) = oneshot::channel();\n\n        let clang_path = extension_manifest.grammars.is_empty().not().then(|| {\n            std::iter::repeat_n(\n                async {\n                    self.install_wasi_sdk_if_needed()\n                        .await\n                        .log_err()\n                        .map(Arc::new)\n                }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/extension/src/extension_builder.rs#L84-L120","documentation":"A precondition check at the top of compile_extension: the caller passed a relative extension_dir, but the builder later joins it with cache directories and spawns git/clang with it as a working directory, which only behaves deterministically for absolute paths. The ensure! fires before any compilation starts; the input at fault is the extension_dir argument itself, which must be canonicalized/absolutized by the caller (e.g. the CLI entry point in main).","triggerScenarios":"Thrown at crates/extension/src/extension_builder.rs:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an absolute path: construct it via std::fs::canonicalize(extension_dir) or PathBuf::from(env::current_dir()?).join(extension_dir) before calling compile_extension","If invoking from the CLI, resolve the user-supplied path argument against the current working directory at parse time"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}