nikivdev/code · error

{} does not contain {}

Error message

{} does not contain {}

What it means

`resolve_install_source_paths` accepts either a directory containing a manifest file (`MANIFEST_NAME`) or the manifest file itself. When given a directory with no manifest inside, it bails with this error naming the directory and the expected manifest filename.

Source

Thrown at src/external_cli.rs:445

        .parent()
        .unwrap_or_else(|| Path::new("."))
        .to_path_buf();
    Ok(ResolvedExternalCliTool {
        source_root,
        manifest_path,
        manifest,
        resolution,
        registration_path,
    })
}

fn resolve_install_source_paths(path: &Path) -> Result<(PathBuf, PathBuf)> {
    let meta = fs::metadata(path)
        .with_context(|| format!("failed to read external CLI source {}", path.display()))?;
    if meta.is_dir() {
        let manifest_path = path.join(MANIFEST_NAME);
        if !manifest_path.is_file() {
            bail!("{} does not contain {}", path.display(), MANIFEST_NAME);
        }
        return Ok((path.to_path_buf(), manifest_path));
    }

    if meta.is_file() && path.file_name().and_then(|name| name.to_str()) == Some(MANIFEST_NAME) {
        let source_root = path
            .parent()
            .unwrap_or_else(|| Path::new("."))
            .to_path_buf();
        return Ok((source_root, path.to_path_buf()));
    }

    bail!(
        "{} must be an external CLI source directory or {} file",
        path.display(),
        MANIFEST_NAME
    )
}

View on GitHub (pinned to a747e741ae)

Solutions

  1. Ensure the source directory contains a manifest file named exactly as `MANIFEST_NAME` at its top level.
  2. Alternatively pass the manifest file path directly instead of the directory.
  3. Move/copy the manifest into the directory you are installing from.
  4. Check you didn't point at a parent directory one level above the manifest.

Example fix

// before
installer.install_external_cli_link(Path::new("~/src/my-tool/src"))?;
// after
installer.install_external_cli_link(Path::new("~/src/my-tool"))?; // contains manifest at root
Defensive patterns

Strategy: validation

Validate before calling

fn assert_install_source(path: &Path, manifest_name: &str) -> Result<(), String> {
    let meta = std::fs::metadata(path).map_err(|e| e.to_string())?;
    if meta.is_dir() {
        if path.join(manifest_name).is_file() { return Ok(()); }
        return Err(format!("{} lacks {}", path.display(), manifest_name));
    }
    if meta.is_file() && path.file_name().map_or(false, |n| n == manifest_name) { return Ok(()); }
    Err(format!("{} is not a tool source dir or manifest", path.display()))
}

Try / catch

match installer.install_external_cli_link(&src) {
    Err(e) if e.to_string().contains("does not contain") => {
        eprintln!("{e}; retrying with the manifest file directly");
        installer.install_external_cli_link(&src.join(MANIFEST_NAME))
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling `install_external_cli_link` with a source path that `fs::metadata` reports as a directory, but `path.join(MANIFEST_NAME)` is not a regular file.

Common situations: Pointing the installer at a repo root that doesn't contain the manifest at its top level; the manifest was deleted or renamed; passing an empty/placeholder directory.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/730ae8b84bce2dab. Report an issue: GitHub.