jdx/mise · error

config file not found: {}

Error message

config file not found: {}

What it means

mise config set resolved an explicit --file target but the path does not exist on disk (src/cli/config/set.rs:77). Set refuses to create files implicitly - writing into a guessed layout could clobber the user's intended config structure - so the file must already be there.

Source

Thrown at src/cli/config/set.rs:77

                })?;
                (k.to_string(), v.to_string())
            }
        };
        // Only an explicitly named target goes through the shared resolver — the default is a
        // different rule (the top TOML config of the loaded set, not the nearest writable one).
        let file = match self.file {
            Some(path) => Some(resolve_target_config_path(ConfigPathOptions {
                path: Some(path),
                prefer_toml: true,
                ..Default::default()
            })?),
            None => top_toml_config(),
        };
        let Some(file) = file else {
            bail!("No mise.toml file found");
        };
        if !file.exists() {
            bail!("config file not found: {}", display_path(&file));
        }
        let mut config: toml_edit::DocumentMut = std::fs::read_to_string(&file)?.parse()?;
        let mut container = config.as_item_mut();
        let parts = full_key.split('.').collect::<Vec<&str>>();
        let last_key = parts.last().unwrap();
        for (idx, part) in parts.iter().take(parts.len() - 1).enumerate() {
            container = container
                .as_table_like_mut()
                .ok_or_else(|| {
                    eyre::eyre!(
                        "cannot set '{full_key}': '{}' is already set to a non-table value",
                        parts[..idx].join(".")
                    )
                })?
                .entry(part)
                .or_insert({
                    let mut t = toml_edit::Table::new();
                    t.set_implicit(true);

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Create the file first (touch) or point --file at an existing config
  2. If a directory was passed, ensure it actually contains a mise.toml
  3. Use absolute paths in scripts
  4. Add a one-time scaffolding step to repo setup, then let scripts set values

Example fix

# before
mise config set --file envs/prod/mise.toml env.FOO bar
# Error: config file not found: envs/prod/mise.toml

# after
touch envs/prod/mise.toml
mise config set --file envs/prod/mise.toml env.FOO bar
Defensive patterns

Strategy: validation

Validate before calling

# bash: refuse to run set against a missing --file target
[ -f "$FILE" ] || [ -f "$FILE/mise.toml" ] || { echo "refusing: $FILE does not exist" >&2; exit 1; }
mise config set --file "$FILE" "$KEY" "$VALUE"

Prevention

When it happens

Trigger: 'mise config set --file ./envs/prod/mise.toml key value' with the file missing; --file given a directory that contains no config; path typos; relative paths resolved from an unexpected cwd.

Common situations: Scripts assuming a target env config exists; freshly cloned repos with gitignored local configs; pipeline steps that run before the scaffolding step.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/c42968ebf37a1979. Report an issue: GitHub.