nikivdev/code · error
unable to parse repository URL: {}
Error message
unable to parse repository URL: {} What it means
This is parse_generic_repo's final fallback: if the input is non-empty, not parseable as a URL with a usable path, and not recognized as a shorthand/scp-style reference, the function gives up and bails with the raw input embedded in the message. It signals the string is not in any repository-reference format the library understands.
Source
Thrown at src/repos.rs:1718
if let Some(colon) = trimmed[at + 1..].find(':') {
let rest = &trimmed[at + 1 + colon + 1..];
let path = rest
.trim_matches('/')
.split('/')
.filter(|p| !p.is_empty())
.map(|p| p.trim_end_matches(".git").to_string())
.collect::<Vec<_>>();
if path.is_empty() {
bail!("unable to parse repository from: {}", input);
}
return Ok(GenericRepoRef {
path,
clone_url: trimmed.to_string(),
});
}
}
bail!("unable to parse repository URL: {}", input)
}
pub(crate) fn parse_github_repo(input: &str) -> Result<RepoRef> {
let trimmed = input.trim();
if trimmed.is_empty() {
bail!("missing repository URL");
}
let path = if let Some(rest) = trimmed.strip_prefix("git@github.com:") {
rest
} else if let Some(idx) = trimmed.find("github.com/") {
&trimmed[idx + "github.com/".len()..]
} else {
trimmed
};
let path = path
.trim_start_matches('/')View on GitHub (pinned to a747e741ae)
Solutions
- Use a full repository URL (https://host/owner/repo.git) or an scp-style ref (git@host:owner/repo.git) or a recognized shorthand (owner/repo)
- Check for typos in the URL scheme and stray whitespace/special characters
- If it's a local path, confirm the library supports local paths or convert it to a file:// URL
Example fix
// before
let r = parse_generic_repo("my repo thing")?;
// after
let r = parse_generic_repo("https://gitlab.com/group/repo.git")?; Defensive patterns
Strategy: validation
Validate before calling
fn looks_like_repo_ref(input: &str) -> bool {
let t = input.trim();
t.contains("://") || t.contains('@') || t.split('/').filter(|p| !p.is_empty()).count() >= 2
} Type guard
fn is_parseable_repo_ref(input: &str) -> bool {
let t = input.trim();
!t.is_empty() && (t.starts_with("http://") || t.starts_with("https://") || t.contains('@') || t.split('/').count() >= 2)
} Try / catch
let r = parse_generic_repo(input).unwrap_or_else(|e| {
eprintln!("{e}; expected a URL, scp-style ref, or owner/repo shorthand");
std::process::exit(2);
}); Prevention
- Use one of the three accepted formats: URL, scp ref, or shorthand
- Fix typos in URL schemes (htps:// -> https://)
- Don't paste free-form documentation text as a repo reference
- Convert local paths to file:// URLs if supported
When it happens
Trigger: Passing malformed input to parse_generic_repo such as "not a url!!", "://bad", "owner only" (no '/', '@', or scheme), or a reference format the parser doesn't recognize.
Common situations: Typos in scheme (htps://...); free-form text pasted from docs; Windows-style paths or local file paths the parser doesn't treat as URLs; a config value with stray characters.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- unable to parse repository path from: {}
- unable to parse repository from: {}
- missing repository URL
- unable to parse GitHub repo from: {}
- jj git export retry loop should always return
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/32e7daae54d90ab8.
Report an issue: GitHub.