jdx/mise · error

config file not found: {}

Error message

config file not found: {}

What it means

mise config get (src/cli/config/get.rs:36) resolved an explicit --file target (a file path, or a directory whose config file it derives) but that path does not exist on disk, so the read is refused. Only the explicit --file route hits this; the no-flag default fails differently ('No mise.toml file found').

Source

Thrown at src/cli/config/get.rs:36

    #[clap(short, long, visible_alias = "path", value_hint = clap::ValueHint::AnyPath)]
    pub file: Option<PathBuf>,
}

impl ConfigGet {
    pub fn run(self) -> eyre::Result<()> {
        // 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(),
        };
        if let Some(file) = file {
            if !file.exists() {
                bail!("config file not found: {}", display_path(&file));
            }
            let content = std::fs::read_to_string(&file)?;
            let config: toml::Value = toml::de::from_str(&content)?;
            let mut value = &config;
            if let Some(key) = &self.key {
                for k in key.split('.') {
                    value = value.get(k).ok_or_else(|| {
                        eyre::eyre!("Key not found: {} in {}", key, display_path(&file))
                    })?;
                }
            }

            match value {
                toml::Value::String(s) => miseprintln!("{}", s),
                toml::Value::Integer(i) => miseprintln!("{}", i),
                toml::Value::Boolean(b) => miseprintln!("{}", b),
                toml::Value::Float(f) => miseprintln!("{}", f),
                toml::Value::Datetime(d) => miseprintln!("{}", d),

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Verify what you passed: ls the --file argument; directories must contain a mise.toml
  2. Use an absolute path to remove cwd ambiguity
  3. Create the file first (touch mise.toml) before reading it
  4. Omit --file to operate on the top TOML config of the loaded set when one exists

Example fix

# before
mise config get tools.python --file envs/prod/mise.toml
# Error: config file not found: envs/prod/mise.toml

# after
cd envs/prod && mise config get tools.python   # or fix the path
Defensive patterns

Strategy: validation

Validate before calling

# bash: resolve and test the target before calling mise config get
f="$CONFIG_FILE"
[ -f "$f" ] || [ -f "$f/mise.toml" ] || { echo "config not found: $f" >&2; exit 1; }
mise config get "$KEY" --file "$f"

Prevention

When it happens

Trigger: 'mise config get tools.python --file ./nope/mise.toml'; --file pointing at a directory containing no mise.toml; a config moved or deleted between resolution and read; relative paths interpreted from an unexpected cwd.

Common situations: Fresh CI clones before config generation; wrong relative path because the script cd'd elsewhere; renamed or gitignored local configs.

Related errors


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