jdx/mise · error

a repository url is required

Error message

a repository url is required

What it means

`mise dot origin set` requires a repository URL to connect to. `set_inner` validates `opts.url` and bails immediately if it is empty or whitespace-only, since connecting to a blank remote is meaningless.

Solutions

  1. Pass the repository URL explicitly: `mise dot origin set git@github.com:user/repo.git`
  2. Fix the shell variable so it contains the actual remote URL
  3. Run `git remote get-url origin` in the target repo to obtain the correct URL

Example fix

// before
mise dot origin set "$REMOTE"   # REMOTE empty
// after
mise dot origin set git@github.com:user/repo.git
Defensive patterns

Strategy: validation

Validate before calling

let url = std::env::var("REMOTE").unwrap_or_default();
if url.trim().is_empty() {
    eprintln!("REMOTE is empty; pass a repository url to `mise dot origin set`");
    std::process::exit(2);
}

Try / catch

match result {
    Err(e) if e.to_string().contains("a repository url is required") => eprintln!("usage: mise dot origin set <url>"),
    _ => {}
}

Prevention

When it happens

Trigger: Running `mise dot origin set` with no URL argument or with an empty/blank string as the URL.

Common situations: Forgetting the positional URL argument; a shell variable holding the remote URL is unset (`mise dot origin set "$REMOTE"` with empty REMOTE); copy-paste dropped the URL.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/2d0d6a4ea6decf2a. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/sync/origin.rs:78

            );
            return Err(match result {
                Err(err) => err.wrap_err(message),
                Ok(()) => eyre::eyre!(message),
            });
        }
    }
    result
}

async fn set_inner(
    store: &Store,
    tracked: &TrackedSet,
    opts: &SetOptions,
    accepted: &mut bool,
    preview_lock: &mut Option<fslock::LockFile>,
) -> Result<()> {
    if opts.url.trim().is_empty() {
        bail!("a repository url is required");
    }
    let repo = store
        .repo()
        .ok_or_else(|| eyre::eyre!("connecting a setup repository requires git"))?;
    let state_dir = store.state_dir();
    // the connection as it was: another repository or branch starts from a
    // clean slate, and a scheme change on the same one replaces its refs
    let status_before = run::read_status(state_dir)?;
    // This is the disposable preview repository. The connected repository's
    // remote-tracking ref remains untouched unless the connection is confirmed.
    let remote = Remote::new(repo, &opts.url);
    // re-running the same connection keeps the branch it already has, so an
    // unattended `origin set <url> --yes` stays idempotent when the
    // repository's default branch is not the one this machine follows
    let connected = (!status_before.disconnected
        && status_before.origin_url.as_deref() == Some(opts.url.as_str()))
    .then_some(status_before.origin_branch.as_deref())
    .flatten();

View on GitHub (pinned to 533346cc37)