{"record":{"id":"6422588e5de781f7","repo":"xai-org/grok-build","slug":"local-marketplace-path-not-found-or-is-not-a-dire","errorCode":null,"errorMessage":"Local marketplace path not found (or is not a directory): {}","messagePattern":"Local marketplace path not found \\(or is not a directory\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/plugin_cmd.rs","lineNumber":864,"sourceCode":"    sources: &[xai_grok_plugin_marketplace::MarketplaceSource],\n    url: &str,\n    force: bool,\n) -> Result<()> {\n    use xai_grok_shell::plugin::MarketplaceAddInput;\n\n    let url = url.trim();\n    if url.is_empty() {\n        bail!(\"URL cannot be empty.\");\n    }\n\n    let cwd = std::env::current_dir().unwrap_or_default();\n    let input = plugin::classify_marketplace_add_input(url, &cwd);\n\n    // Fail fast on missing local paths: otherwise a path input is stored as a git URL and only errors after network clone attempts\n    if let MarketplaceAddInput::LocalPath(path) = &input\n        && !path.is_dir()\n    {\n        bail!(\n            \"Local marketplace path not found (or is not a directory): {}\",\n            path.display()\n        );\n    }\n\n    let identity = match &input {\n        MarketplaceAddInput::GitUrl(u) => u.clone(),\n        MarketplaceAddInput::LocalPath(p) => p.display().to_string(),\n    };\n\n    // Local paths never match the git-URL allowlist, so a restricted strictKnownMarketplaces policy blocks them; intentionally fail-closed\n    let allowlist =\n        &xai_grok_workspace::permission::resolution::managed_settings().marketplace_allowlist;\n    if allowlist.is_restricted() && !allowlist.is_url_allowed(&identity) {\n        bail!(\"Marketplace source blocked: {}\", allowlist.block_reason());\n    }\n\n    let already_configured = match &input {","sourceCodeStart":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/plugin_cmd.rs#L846-L882","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the path with `ls -d <path>` and correct the typo","Point at the marketplace directory, not a file","Use an absolute path to avoid cwd mismatch","Create/clone the marketplace locally before adding it"],"exampleFix":"// before\ngrok plugin marketplace add ./mktplce   # typo\n// after\ngrok plugin marketplace add /home/me/code/marketplace","handlingStrategy":"validation","validationCode":"fn ensure_local_marketplace(path: &std::path::Path) -> Result<(), String> {\n    if !path.is_dir() {\n        return Err(format!(\n            \"Local marketplace path not found (or is not a directory): {}\",\n            path.display()\n        ));\n    }\n    Ok(())\n}","typeGuard":"fn is_existing_dir(p: &str) -> bool {\n    std::path::Path::new(p).is_dir()\n}","tryCatchPattern":"match marketplace_add(local_path, None, false, false) {\n    Err(e) if e.to_string().contains(\"Local marketplace path not found\") => {\n        eprintln!(\"Fix the path or clone the marketplace first\");\n    }\n    Ok(_) => {}\n    Err(e) => return Err(e),\n}","preventionTips":["`ls -d <path>` before adding local marketplaces","Use absolute paths so cwd changes don't break relative references","Point at the marketplace directory, not a zip or single repo file"],"tags":["path","marketplace","cli","argument-validation"],"backgroundTag":"local-path-not-found","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}