{"record":{"id":"95980e3bb34b3431","repo":"xai-org/grok-build","slug":"marketplace-source-already-configured-identity","errorCode":null,"errorMessage":"Marketplace source already configured: {identity}","messagePattern":"Marketplace source already configured: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/codegen/xai-grok-pager/src/plugin_cmd.rs","lineNumber":895,"sourceCode":"        &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 {\n        MarketplaceAddInput::GitUrl(git_url) => {\n            let normalized = git_url.trim_end_matches(\".git\");\n            sources.iter().any(|s| {\n                matches!(&s.kind, SourceKind::Git { url: u, .. }\n                    if u.trim_end_matches(\".git\") == normalized)\n            })\n        }\n        MarketplaceAddInput::LocalPath(path) => sources\n            .iter()\n            .any(|s| matches!(&s.kind, SourceKind::Local { path: p } if p == path)),\n    };\n    if already_configured {\n        bail!(\"Marketplace source already configured: {identity}\");\n    }\n\n    if !force && let MarketplaceAddInput::GitUrl(git_url) = &input {\n        xai_grok_plugin_marketplace::git::probe_git_remote(git_url).map_err(|e| {\n            anyhow::anyhow!(\n                \"{e}\\nNot adding \\\"{url}\\\": it doesn't look like a reachable git repository. \\\n                 Re-run with --force to add it anyway (e.g. a host only reachable on VPN).\"\n            )\n        })?;\n    }\n\n    let name = match &input {\n        MarketplaceAddInput::GitUrl(u) => plugin::name_from_url(u),\n        MarketplaceAddInput::LocalPath(p) => plugin::name_from_path(p),\n    };\n    let config_path = xai_grok_config::grok_home().join(xai_grok_config::USER_CONFIG_FILENAME);\n\n    let content = std::fs::read_to_string(&config_path).unwrap_or_default();","sourceCodeStart":877,"sourceCodeEnd":913,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/plugin_cmd.rs#L877-L913","documentation":"The marketplace `add` command rejects a source that is already present in the configured marketplace sources list. Before adding, the command builds an identity (git URL or local path) and checks `already_configured` by comparing against existing sources. This is a deliberate guard against duplicate entries in the marketplace config.","triggerScenarios":"Running `grok marketplace add` (via marketplace_add, called by run_marketplace) with a GitUrl or LocalPath that matches an existing source entry — a git URL equal to a configured source's URL, or a local path equal to a configured SourceKind::Local path.","commonSituations":"Re-running an add command from a script or setup README; forgetting the source was added previously; trying to re-add under a different alias name while the underlying URL/path is unchanged.","solutions":["Do nothing — the source is already configured; run `grok marketplace list` to confirm.","If you want to refresh it, use the marketplace update command instead of add.","If a duplicate with different settings is intended, remove the existing source first, then re-add it."],"exampleFix":"// before\ngrok marketplace add https://github.com/example/plugins.git\n// error: already configured\n// after\ngrok marketplace list   # confirm it exists; skip the add\n// or: grok marketplace remove <name> && grok marketplace add ...","handlingStrategy":"validation","validationCode":"let existing: Vec<String> = list_marketplace_sources();\nlet identity = match &input {\n    MarketplaceAddInput::GitUrl(u) => u.clone(),\n    MarketplaceAddInput::LocalPath(p) => p.display().to_string(),\n};\nif existing.iter().any(|s| s.contains(&identity)) {\n    eprintln!(\"skipping add: already configured: {identity}\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `grok marketplace list` before scripting an add.","Make setup scripts idempotent: check-then-add or tolerate the duplicate error.","Prefer `update` over re-`add` to refresh sources."],"tags":["cli","duplicate-config","marketplace"],"backgroundTag":"duplicate-resource-configured","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}