Hmbown/CodeWhale · error · anyhow::Error

the remote does not resolve to an owner/repo slug

Error message

the {} remote {} does not resolve to an owner/repo slug

What it means

LiveForgePr::open converts the job's remote URL into an owner/repo slug via forge_slug for the job's forge; if the URL cannot be parsed into that shape the PR flow aborts before any title/body work. Per the documented contract, the earlier branch push is not rolled back and no PR URL is ever invented.

Solutions

  1. Set the repo's origin to a standard https or git@ URL for the forge host so forge_slug can extract owner/repo.
  2. Check that job.forge matches the actual remote host (github vs gitee vs cnb); fix the job configuration if they disagree.
  3. Run `git remote -v`, confirm the URL, and normalize it before dispatching the cloud job.

Example fix

// before
git remote set-url origin ssh://git@github.com:2222/acme/widget.git
// after
git remote set-url origin https://github.com/acme/widget.git
Defensive patterns

Strategy: validation

Validate before calling

fn slug_ok(remote_url: &str, forge: Forge) -> bool {
    forge_slug(forge, remote_url).is_some()
}

Try / catch

match pr.open(job, patch) {
    Err(e) if e.to_string().contains("does not resolve to an owner/repo slug") => {
        // branch is pushed; surface the failure and let user open PR manually
    }
    other => other?,
}

Prevention

When it happens

Trigger: open is called for a CloudJob whose remote_url is not a recognizable remote for job.forge (an SSH URL form the parser does not handle, a plain local path, or a remote on a different host than the forge expects).

Common situations: Repo cloned via an unusual remote form (ssh:// with custom port, alias, local path); origin points to a different host than the configured forge; the workspace is not a hosted repository.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/9e0e5689060db389. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/dispatch_runner.rs:461

pub fn gitee_pr_url(slug: &str) -> String {
    format!("https://gitee.com/api/v5/repos/{slug}/pulls")
}

/// CNB pull-request endpoint for a slug.
pub fn cnb_pr_url(slug: &str) -> String {
    format!("https://api.cnb.cool/{slug}/-/pulls")
}

/// Production forge opener: local git for the branch push, then the forge's
/// own API surface for the PR (gh for GitHub; REST for CNB and Gitee with
/// service-slot tokens). Fails closed on missing tooling or tokens — the
/// branch push is not rolled back, and no PR URL is ever invented.
pub struct LiveForgePr;

impl ForgePr for LiveForgePr {
    fn open(&self, job: &CloudJob, patch: &PatchReceipt) -> Result<PrOpened> {
        let slug = forge_slug(job.forge, &job.remote_url).ok_or_else(|| {
            anyhow!(
                "the {} remote {} does not resolve to an owner/repo slug",
                job.forge.as_str(),
                job.remote_url
            )
        })?;
        let title = compose_pr_title(job, patch);
        let dir = tempfile::tempdir().context("could not stage the cloud agent branch")?;
        let head_sha = prepare_branch(job, patch, dir.path())?;
        push_branch(&dir.path().join("repo"), &job.remote_url, &job.branch)?;
        let body = compose_pr_body_for_head(job, patch, &head_sha);
        let url = match job.forge {
            Forge::Github => open_pr_github(&slug, job, patch, &title, &body)?,
            Forge::Gitee => open_pr_gitee(&slug, job, patch, &title, &body)?,
            Forge::Cnb => open_pr_cnb(&slug, job, patch, &title, &body)?,
        };
        Ok(PrOpened { url, head_sha })
    }
}

View on GitHub (pinned to 73e0f67d83)