{"record":{"id":"87751d53ece520cf","repo":"nikivdev/code","slug":"repo-url-required","errorCode":null,"errorMessage":"{} repo URL required","messagePattern":"(.+?) repo URL required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/home.rs","lineNumber":592,"sourceCode":"            if allow_origin_reset {\n                ensure_origin_url(dest, expected)?;\n            } else if let Ok(actual) = git_capture(dest, &[\"remote\", \"get-url\", \"origin\"]) {\n                if !urls_match(expected, actual.trim()) {\n                    bail!(\n                        \"{} origin mismatch: expected {}, got {}\",\n                        label,\n                        expected,\n                        actual.trim()\n                    );\n                }\n            }\n        }\n\n        update_repo(dest)?;\n        return Ok(());\n    }\n\n    let repo_url = repo_url.ok_or_else(|| anyhow::anyhow!(\"{} repo URL required\", label))?;\n    clone_repo(repo_url, dest)?;\n    Ok(())\n}\n\nfn update_repo(dest: &Path) -> Result<()> {\n    run_command(\"git\", &[\"fetch\", \"--prune\", \"origin\"], Some(dest))?;\n    let branch = default_branch(dest)?;\n    run_command(\n        \"git\",\n        &[\"checkout\", \"-B\", &branch, &format!(\"origin/{}\", branch)],\n        Some(dest),\n    )?;\n    run_command(\n        \"git\",\n        &[\"reset\", \"--hard\", &format!(\"origin/{}\", branch)],\n        Some(dest),\n    )?;\n    println!(\"Updated {}\", dest.display());","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/home.rs#L574-L610","documentation":"ensure_repo clones a repo when the destination is missing and requires a repo URL for that case; it throws when the repo is absent from dest and no repo_url argument was supplied. When the repo already exists it just updates, so the URL is optional then.","triggerScenarios":"Calling ensure_repo (via `run` or ensure_kar_repo) with a label/dest where the repo isn't cloned yet and repo_url is None.","commonSituations":"First run on a fresh machine without the URL configured, config missing the repo URL field for the labeled repo, deleted destination directory.","solutions":["Provide the repo URL in config or the command argument for that label","Pre-clone the repo into dest so only update_repo runs","Run the setup/init command that populates default repo URLs"],"exampleFix":"// before\nf home sync mylabel            // no URL known\n// after\nf home sync mylabel --repo https://github.com/org/mylabel.git","handlingStrategy":"validation","validationCode":"let dest_exists = dest.join(\".git\").exists();\nif !dest_exists && repo_url.is_none() {\n    anyhow::bail!(\"{} repo not cloned and no repo URL configured\", label);\n}","typeGuard":null,"tryCatchPattern":"match ensure_repo(label, dest, repo_url) {\n    Err(e) if e.to_string().ends_with(\"repo URL required\") => {\n        eprintln!(\"add repo url for {} to config\", label);\n    }\n    other => other?,\n}","preventionTips":["Configure repo URLs for all managed labels in config","Run initial clone with the URL on a fresh machine","Don't delete managed destination directories without re-supplying URLs"],"tags":["git","config","missing-argument"],"backgroundTag":"missing-required-config","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}