{"record":{"id":"cac80e8e7fa5778a","repo":"nikivdev/code","slug":"missing-repository-url","errorCode":null,"errorMessage":"missing repository URL","messagePattern":"missing repository URL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/repos.rs","lineNumber":1622,"sourceCode":"    println!(\n        \"  switched_to_home_branch: {}\",\n        result.switched_to_home_branch\n    );\n}\n\nfn parse_repo_target(input: &str) -> Result<RepoTarget> {\n    if is_github_input(input) {\n        return parse_github_repo(input).map(RepoTarget::GitHub);\n    }\n\n    let generic = parse_generic_repo(input)?;\n    Ok(RepoTarget::Generic(generic))\n}\n\nfn resolve_git_like_clone_url(input: &str) -> Result<String> {\n    let trimmed = input.trim();\n    if trimmed.is_empty() {\n        bail!(\"missing repository URL\");\n    }\n\n    if trimmed.starts_with(\"git@github.com:\")\n        || trimmed.contains(\"github.com/\")\n        || looks_like_github_shorthand(trimmed)\n    {\n        let repo_ref = parse_github_repo(trimmed)?;\n        return Ok(format!(\n            \"git@github.com:{}/{}.git\",\n            repo_ref.owner, repo_ref.repo\n        ));\n    }\n\n    Ok(trimmed.to_string())\n}\n\nfn looks_like_github_shorthand(input: &str) -> bool {\n    if input.contains(\"://\")","sourceCodeStart":1604,"sourceCodeEnd":1640,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/repos.rs#L1604-L1640","documentation":"resolve_git_like_clone_url rejects an input that is empty after trimming. The library requires a non-blank repository URL/shorthand to resolve a git-like clone target. It is an early-input-validation guard before any URL parsing or host detection happens.","triggerScenarios":"Calling resolve_git_like_clone_url(\"\") or with a whitespace-only string (spaces, tabs, newlines); typically from a config field or CLI flag that was left unset or contains only whitespace.","commonSituations":"Empty repo_url entry in a config file (e.g. `repo_url = \"\"` or `repo_url:` with no value in YAML); an environment variable that resolved to empty; a CLI argument forgotten on the command line.","solutions":["Provide a non-empty repository URL or GitHub shorthand (e.g. https://github.com/owner/repo, git@github.com:owner/repo.git, or owner/repo)","Trim or reject empty values at config-load time with a clearer field-specific message","Check the environment variable or config key feeding the input is actually populated"],"exampleFix":"// before\nlet input = std::env::var(\"REPO_URL\").unwrap_or_default();\nlet url = resolve_git_like_clone_url(&input)?;\n// after\nlet input = std::env::var(\"REPO_URL\")\n    .context(\"REPO_URL must be set\")?;\nlet url = resolve_git_like_clone_url(&input)?;","handlingStrategy":"validation","validationCode":"let trimmed = input.trim();\nanyhow::ensure!(!trimmed.is_empty(), \"repository URL is required\");\nresolve_git_like_clone_url(trimmed)?;","typeGuard":"fn has_repo_url(input: &Option<String>) -> bool {\n    input.as_deref().map_or(false, |s| !s.trim().is_empty())\n}","tryCatchPattern":null,"preventionTips":["Require repo URL fields in config parsing with field-specific errors","Avoid unwrap_or_default() on env vars feeding repo inputs","Trim inputs early so whitespace-only values fail fast with context","Echo which config key/flag was empty in your own error message"],"tags":["input-validation","git","config"],"backgroundTag":"missing-repository-url","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}