cube-js/cube · error

repository must be in owner/repo form, got `{repo}`

Error message

repository must be in owner/repo form, got `{repo}`

What it means

`split_repo` validates a GitHub `owner/repo` identifier in cube-cli's github command. It uses `str::split_once('/')` and requires both halves to be non-empty and the repo part to contain no further slashes. If the argument doesn't match that shape, it throws this anyhow error naming the offending input.

Source

Thrown at rust/cube-cli/src/commands/github.rs:84

    /// Cursor for the next page (from a previous pageInfo.endCursor)
    #[arg(long)]
    after: Option<String>,
}

impl Page {
    fn query(&self) -> crate::client::Query {
        let mut query = Vec::new();
        util::push(&mut query, "first", &self.first);
        util::push(&mut query, "after", &self.after);
        query
    }
}

/// Split an `owner/repo` argument into its two parts.
fn split_repo(repo: &str) -> Result<(&str, &str)> {
    repo.split_once('/')
        .filter(|(owner, name)| !owner.is_empty() && !name.is_empty() && !name.contains('/'))
        .ok_or_else(|| anyhow::anyhow!("repository must be in owner/repo form, got `{repo}`"))
}

pub async fn command(args: Args, ctx: &Ctx) -> Result<()> {
    let api = ctx.api()?;
    match args.cmd {
        Cmd::Status => {
            let res = api.get("/api/v1/github/status", &Vec::new()).await?;
            output::print_json(&res);
        }
        Cmd::Installations { page } => {
            let res = api
                .get("/api/v1/github/installations", &page.query())
                .await?;
            output::print_list(
                ctx.json,
                &res,
                &[("INSTALLATION", "installationId"), ("ACCOUNT", "login")],
            );

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Pass the repository exactly as `owner/repo` (e.g. `cube-tools/cube-cli`).
  2. If you have a full URL, strip the prefix: use the path after `github.com/`.
  3. Trim stray whitespace/trailing slashes from the argument before invoking.
  4. For nested paths, the tool does not support them — use the canonical two-segment form.

Example fix

// before
cube-cli github status https://github.com/cube-js/cube
// after
cube-cli github status cube-js/cube
Defensive patterns

Strategy: validation

Validate before calling

fn is_owner_repo(repo: &str) -> bool {
    matches!(repo.split_once('/'), Some((o, n)) if !o.is_empty() && !n.is_empty() && !n.contains('/'))
}

Type guard

fn as_owner_repo(repo: &str) -> Option<(&str, &str)> {
    repo.split_once('/')
        .filter(|(o, n)| !o.is_empty() && !n.is_empty() && !n.contains('/'))
}

Prevention

When it happens

Trigger: Calling `cube-cli github` (Status, etc.) with a repository argument like `""`, `"owner"` (no slash), `"/repo"`, `"owner/"`, or `"owner/repo/extra"` — anything failing `split_once('/')` with non-empty parts and no trailing `/`.

Common situations: Typing just a repo name forgetting the owner, pasting a full GitHub URL (`https://github.com/owner/repo`) instead of the path form, or a trailing slash from copy-paste.

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 cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/f7c7e30e62e5ee88. Report an issue: GitHub.