{"record":{"id":"3fe95d375aab11d8","repo":"jdx/mise","slug":"config-file-not-found","errorCode":null,"errorMessage":"config file not found: {}","messagePattern":"config file not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/config/get.rs","lineNumber":36,"sourceCode":"    #[clap(short, long, visible_alias = \"path\", value_hint = clap::ValueHint::AnyPath)]\n    pub file: Option<PathBuf>,\n}\n\nimpl ConfigGet {\n    pub fn run(self) -> eyre::Result<()> {\n        // Only an explicitly named target goes through the shared resolver — the default is a\n        // different rule (the top TOML config of the loaded set, not the nearest writable one).\n        let file = match self.file {\n            Some(path) => Some(resolve_target_config_path(ConfigPathOptions {\n                path: Some(path),\n                prefer_toml: true,\n                ..Default::default()\n            })?),\n            None => top_toml_config(),\n        };\n        if let Some(file) = file {\n            if !file.exists() {\n                bail!(\"config file not found: {}\", display_path(&file));\n            }\n            let content = std::fs::read_to_string(&file)?;\n            let config: toml::Value = toml::de::from_str(&content)?;\n            let mut value = &config;\n            if let Some(key) = &self.key {\n                for k in key.split('.') {\n                    value = value.get(k).ok_or_else(|| {\n                        eyre::eyre!(\"Key not found: {} in {}\", key, display_path(&file))\n                    })?;\n                }\n            }\n\n            match value {\n                toml::Value::String(s) => miseprintln!(\"{}\", s),\n                toml::Value::Integer(i) => miseprintln!(\"{}\", i),\n                toml::Value::Boolean(b) => miseprintln!(\"{}\", b),\n                toml::Value::Float(f) => miseprintln!(\"{}\", f),\n                toml::Value::Datetime(d) => miseprintln!(\"{}\", d),","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/config/get.rs#L18-L54","documentation":"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').","triggerScenarios":"'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.","commonSituations":"Fresh CI clones before config generation; wrong relative path because the script cd'd elsewhere; renamed or gitignored local configs.","solutions":["Verify what you passed: ls the --file argument; directories must contain a mise.toml","Use an absolute path to remove cwd ambiguity","Create the file first (touch mise.toml) before reading it","Omit --file to operate on the top TOML config of the loaded set when one exists"],"exampleFix":"# before\nmise config get tools.python --file envs/prod/mise.toml\n# Error: config file not found: envs/prod/mise.toml\n\n# after\ncd envs/prod && mise config get tools.python   # or fix the path","handlingStrategy":"validation","validationCode":"# bash: resolve and test the target before calling mise config get\nf=\"$CONFIG_FILE\"\n[ -f \"$f\" ] || [ -f \"$f/mise.toml\" ] || { echo \"config not found: $f\" >&2; exit 1; }\nmise config get \"$KEY\" --file \"$f\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate or commit config files before jobs that read them","Use absolute paths for --file"],"tags":["mise","config","file-not-found","cli-args"],"backgroundTag":"config-file-not-found","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}