zed-industries/zed · error

extension dir {extension_dir:?} is not an absolute path

Error message

extension dir {extension_dir:?} is not an absolute path

What it means

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).

Source

Thrown at crates/extension/src/extension_builder.rs:102

    pub fn new(http_client: Arc<dyn HttpClient>, cache_dir: PathBuf) -> Self {
        Self {
            cache_dir,
            http: http_client,
        }
    }

    pub async fn compile_extension(
        &self,
        extension_dir: &Path,
        extension_manifest: &mut ExtensionManifest,
        options: CompileExtensionOptions,
        fs: Arc<dyn Fs>,
    ) -> Result<()> {
        let start = std::time::Instant::now();

        populate_defaults(extension_manifest, extension_dir, fs.clone()).await?;

        anyhow::ensure!(
            extension_dir.is_absolute(),
            "extension dir {extension_dir:?} is not an absolute path"
        );

        fs.create_dir(&self.cache_dir)
            .await
            .context("creating cache directory")?;

        let (tx, mut rx) = oneshot::channel();

        let clang_path = extension_manifest.grammars.is_empty().not().then(|| {
            std::iter::repeat_n(
                async {
                    self.install_wasi_sdk_if_needed()
                        .await
                        .log_err()
                        .map(Arc::new)
                }

View on GitHub (pinned to 9d272b0363)

Solutions

  1. 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
  2. If invoking from the CLI, resolve the user-supplied path argument against the current working directory at parse time
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/extension/src/extension_builder.rs:102 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-09-12). Data as JSON: /api/errors/c0af601b2222bdad. Report an issue: GitHub.