nikivdev/code · error

missing repository URL

Error message

missing repository URL

What it means

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.

Source

Thrown at src/repos.rs:1622

    println!(
        "  switched_to_home_branch: {}",
        result.switched_to_home_branch
    );
}

fn parse_repo_target(input: &str) -> Result<RepoTarget> {
    if is_github_input(input) {
        return parse_github_repo(input).map(RepoTarget::GitHub);
    }

    let generic = parse_generic_repo(input)?;
    Ok(RepoTarget::Generic(generic))
}

fn resolve_git_like_clone_url(input: &str) -> Result<String> {
    let trimmed = input.trim();
    if trimmed.is_empty() {
        bail!("missing repository URL");
    }

    if trimmed.starts_with("git@github.com:")
        || trimmed.contains("github.com/")
        || looks_like_github_shorthand(trimmed)
    {
        let repo_ref = parse_github_repo(trimmed)?;
        return Ok(format!(
            "git@github.com:{}/{}.git",
            repo_ref.owner, repo_ref.repo
        ));
    }

    Ok(trimmed.to_string())
}

fn looks_like_github_shorthand(input: &str) -> bool {
    if input.contains("://")

View on GitHub (pinned to a747e741ae)

Solutions

  1. 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)
  2. Trim or reject empty values at config-load time with a clearer field-specific message
  3. Check the environment variable or config key feeding the input is actually populated

Example fix

// before
let input = std::env::var("REPO_URL").unwrap_or_default();
let url = resolve_git_like_clone_url(&input)?;
// after
let input = std::env::var("REPO_URL")
    .context("REPO_URL must be set")?;
let url = resolve_git_like_clone_url(&input)?;
Defensive patterns

Strategy: validation

Validate before calling

let trimmed = input.trim();
anyhow::ensure!(!trimmed.is_empty(), "repository URL is required");
resolve_git_like_clone_url(trimmed)?;

Type guard

fn has_repo_url(input: &Option<String>) -> bool {
    input.as_deref().map_or(false, |s| !s.trim().is_empty())
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/cac80e8e7fa5778a. Report an issue: GitHub.