{"record":{"id":"4a9df57353f2bd63","repo":"xai-org/grok-build","slug":"url-cannot-be-empty","errorCode":null,"errorMessage":"URL cannot be empty.","messagePattern":"URL cannot be empty\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/plugin_cmd.rs","lineNumber":854,"sourceCode":"                SourceKind::Git { url, .. } => url.clone(),\n                SourceKind::Local { path } => path.display().to_string(),\n            };\n            println!(\"  {}: {id}\", s.name);\n        }\n    }\n    Ok(())\n}\n\nfn marketplace_add(\n    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(),","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/plugin_cmd.rs#L836-L872","documentation":"`grok plugin marketplace add` requires a non-empty URL or path. The input is trimmed and, if empty, the command bails with 'URL cannot be empty.' before any classification or network work.","triggerScenarios":"Running `grok plugin marketplace add` with an empty string or whitespace-only argument (e.g. an unset shell variable expands to nothing).","commonSituations":"`$MARKETPLACE_URL` environment variable unset; script passing empty arg; copy-paste dropped the URL; quoting mistake producing an empty string.","solutions":["Re-run with the actual marketplace git URL or local path","Check the env var is set: `echo $MARKETPLACE_URL`","Quote the argument in scripts: `grok plugin marketplace add \"$URL\"`"],"exampleFix":"// before\ngrok plugin marketplace add $MARKETPLACE_URL   # unset → empty\n// after\ngrok plugin marketplace add \"https://github.com/org/marketplace.git\"","handlingStrategy":"validation","validationCode":"fn ensure_non_empty(input: &str) -> Result<&str, String> {\n    let t = input.trim();\n    if t.is_empty() {\n        return Err(\"URL cannot be empty\".into());\n    }\n    Ok(t)\n}","typeGuard":"fn is_non_empty(s: &str) -> bool {\n    !s.trim().is_empty()\n}","tryCatchPattern":"match marketplace_add(input, None, false, false) {\n    Err(e) if e.to_string().contains(\"URL cannot be empty\") => {\n        eprintln!(\"Provide a marketplace URL or local path\");\n    }\n    Ok(_) => {}\n    Err(e) => return Err(e),\n}","preventionTips":["Quote shell variables: \"$MARKETPLACE_URL\"","Default-check env vars in scripts before invoking the CLI","Use interactive prompts that reject empty input"],"tags":["cli","argument-validation","marketplace"],"backgroundTag":"empty-argument","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}