jdx/mise · error

relative repo paths are only allowed in a project config…

Error message

relative repo paths are only allowed in a project config; use an absolute path or a `~/` path

What it means

A relative `path` in a `[repos]` entry can only be resolved against a project root, which exists only when the config is part of a project (e.g. a `mise.toml` in the repo). When `RepoRequest::from_toml` is called with `project_root = None` (global/user-level config) and the path is relative, mise cannot anchor it and rejects the value, telling you to use an absolute or `~/` path instead.

Solutions

  1. Make the path home-relative in the global config: `path = "~/src/config-repo"`.
  2. Or use a fully absolute path: `path = "/opt/repos/config-repo"`.
  3. Or keep the relative path but move the entry back into a project-level `mise.toml` where a project root exists.
  4. Note: even in project configs, the relative path must stay within the project root (no `..` segments).

Example fix

# before (global config.toml)
[repos]
path = "config-repo"

# after
[repos]
path = "~/src/config-repo"
Defensive patterns

Strategy: validation

Validate before calling

const isRelative = repoPath && !repoPath.startsWith('/') && !repoPath.startsWith('~/');
if (isRelative && !isProjectConfig) throw new Error('relative repo path requires a project config; use /abs or ~/ in global config');

Try / catch

try {
  parseRepoToml(cfg, { projectRoot: null });
} catch (e) {
  if (/relative repo paths are only allowed in a project config/.test(String(e.cause ?? e))) {
    console.error('move the entry to a project mise.toml or make the path absolute/home-relative');
  }
  throw e;
}

Prevention

When it happens

Trigger: Declaring a relative repo `path` (after tilde expansion) in a global config file such as `~/.config/mise/config.toml`, where no project_root is passed to `RepoRequest::from_toml`.

Common situations: Moving a repos entry from a project `mise.toml` into the global config without converting `path = "config-repo"` to an absolute or `~/` path; writing global shared repo definitions assuming a cwd-relative resolution that mise intentionally does not perform.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/system/repos.rs:90

}

impl RepoRequest {
    pub(crate) fn from_toml(
        path_raw: String,
        config: RepoTomlConfig,
        project_root: Option<&Path>,
    ) -> Result<Self> {
        if path_raw.starts_with('~') && !path_raw.starts_with("~/") {
            bail!(
                "repo path `{path_raw}` cannot start with `~`; use `~/` for a home-relative path"
            );
        }
        let path = file::replace_path(&path_raw);
        let path = if path.is_absolute() {
            path
        } else {
            let Some(root) = project_root else {
                bail!(
                    "relative repo paths are only allowed in a project config; use an absolute path or a `~/` path"
                );
            };
            if path.components().any(|component| {
                matches!(
                    component,
                    Component::ParentDir | Component::RootDir | Component::Prefix(_)
                )
            }) {
                bail!(
                    "relative repo path `{path_raw}` must stay within the project root (no `..` or absolute segments)"
                );
            }
            if !path
                .components()
                .any(|component| matches!(component, Component::Normal(_)))
            {
                bail!(

View on GitHub (pinned to 533346cc37)