xai-org/grok-build · error

Local marketplace path not found (or is not a directory): {}

Error message

Local marketplace path not found (or is not a directory): {}

What it means

When the marketplace-add input is classified as a local path, the command fails fast if the path is not an existing directory, bailing with 'Local marketplace path not found (or is not a directory): {path}'. This prevents storing a bogus local path as a git URL that would only fail later during network clone.

Source

Thrown at crates/codegen/xai-grok-pager/src/plugin_cmd.rs:864

    sources: &[xai_grok_plugin_marketplace::MarketplaceSource],
    url: &str,
    force: bool,
) -> Result<()> {
    use xai_grok_shell::plugin::MarketplaceAddInput;

    let url = url.trim();
    if url.is_empty() {
        bail!("URL cannot be empty.");
    }

    let cwd = std::env::current_dir().unwrap_or_default();
    let input = plugin::classify_marketplace_add_input(url, &cwd);

    // Fail fast on missing local paths: otherwise a path input is stored as a git URL and only errors after network clone attempts
    if let MarketplaceAddInput::LocalPath(path) = &input
        && !path.is_dir()
    {
        bail!(
            "Local marketplace path not found (or is not a directory): {}",
            path.display()
        );
    }

    let identity = match &input {
        MarketplaceAddInput::GitUrl(u) => u.clone(),
        MarketplaceAddInput::LocalPath(p) => p.display().to_string(),
    };

    // Local paths never match the git-URL allowlist, so a restricted strictKnownMarketplaces policy blocks them; intentionally fail-closed
    let allowlist =
        &xai_grok_workspace::permission::resolution::managed_settings().marketplace_allowlist;
    if allowlist.is_restricted() && !allowlist.is_url_allowed(&identity) {
        bail!("Marketplace source blocked: {}", allowlist.block_reason());
    }

    let already_configured = match &input {

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Verify the path with `ls -d <path>` and correct the typo
  2. Point at the marketplace directory, not a file
  3. Use an absolute path to avoid cwd mismatch
  4. Create/clone the marketplace locally before adding it

Example fix

// before
grok plugin marketplace add ./mktplce   # typo
// after
grok plugin marketplace add /home/me/code/marketplace
Defensive patterns

Strategy: validation

Validate before calling

fn ensure_local_marketplace(path: &std::path::Path) -> Result<(), String> {
    if !path.is_dir() {
        return Err(format!(
            "Local marketplace path not found (or is not a directory): {}",
            path.display()
        ));
    }
    Ok(())
}

Type guard

fn is_existing_dir(p: &str) -> bool {
    std::path::Path::new(p).is_dir()
}

Try / catch

match marketplace_add(local_path, None, false, false) {
    Err(e) if e.to_string().contains("Local marketplace path not found") => {
        eprintln!("Fix the path or clone the marketplace first");
    }
    Ok(_) => {}
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running `grok plugin marketplace add ./local-marketplace` where the path doesn't exist, is a file, or is relative to a different cwd than expected.

Common situations: Typo in the local path; pointing at a zip file or single repo folder instead of a marketplace directory; running the command from a different working directory so the relative path misses.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/6422588e5de781f7. Report an issue: GitHub.