{"record":{"id":"959ce24f7d3027dc","repo":"jdx/mise","slug":"path-does-not-exist-mise-resolves-this-to-a-tr","errorCode":null,"errorMessage":"Path does not exist: {}\nmise resolves this to a trust root before recording anything, and that resolution is lexical — a path that is not there would act on its parent directory instead.","messagePattern":"Path does not exist: (.+?)\nmise resolves this to a trust root before recording anything, and that resolution is lexical — a path that is not there would act on its parent directory instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/trust.rs","lineNumber":220,"sourceCode":"}\n\n/// The config file a user-supplied path refers to, or `None` when none was given.\n///\n/// The path has to exist. Trusting is not done against the path as typed: it is resolved to a\n/// trust root first, and `config_root` does that by counting path components, never by looking at\n/// the filesystem. A path that is not there therefore used to resolve to its *parent*, and mise\n/// would trust or untrust that instead — exit 0, `trusted <parent>`, and a typo silently granting\n/// trust to a directory nobody named.\n///\n/// Existence is the whole check. A directory with no config file in it yet still resolves, since\n/// its trust root is the directory itself and trusting a project before writing its `mise.toml`\n/// is a real thing to want.\npub(super) fn resolve_config_file(config_file: Option<&PathBuf>) -> Result<Option<PathBuf>> {\n    let Some(config_file) = config_file else {\n        return Ok(None);\n    };\n    if !config_file.exists() {\n        bail!(\n            \"Path does not exist: {}\\n\\\n             mise resolves this to a trust root before recording anything, and that resolution is \\\n             lexical — a path that is not there would act on its parent directory instead.\",\n            display_path(config_file)\n        );\n    }\n    Ok(Some(if config_file.is_dir() {\n        config_files_in_dir(config_file)\n            .last()\n            .cloned()\n            .unwrap_or(config_file.join(&*env::MISE_DEFAULT_CONFIG_FILENAME))\n    } else {\n        config_file.clone()\n    }))\n}\n\nimpl Trust {\n    fn ignore(&self) -> Result<()> {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/trust.rs#L202-L238","documentation":"`mise trust` (trust command's resolve_config_file) refuses paths that do not exist on disk. Because mise resolves trust roots lexically (e.g. a config's parent directory), trusting a nonexistent path would silently act on its parent, which is almost never what the user wants, so it bails instead.","triggerScenarios":"Running `mise trust` or `mise trust <path>` where the given config_file argument fails `config_file.exists()` inside resolve_config_file.","commonSituations":"Trusting a config file you deleted or moved; a typo'd path; trusting a config path before creating the file; scripts hardcoding a path that differs across machines.","solutions":["Verify the path exists (`ls <path>`); fix typos.","Create or restore the config file first, then run `mise trust`.","If you meant to trust the directory's config, pass the existing config file's path (e.g. the mise.toml that actually exists)."],"exampleFix":"// before\nmise trust ./configs/mise.toml   # file not created yet\n// after\ntouch ./configs/mise.toml\nmise trust ./configs/mise.toml","handlingStrategy":"validation","validationCode":"[ -e ./mise.toml ] && mise trust ./mise.toml","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check path existence before running mise trust.","Avoid trusting paths in scripts; trust checked-in config files after checkout.","Create the config file first, then trust it."],"tags":["cli","trust","path-validation"],"backgroundTag":"file-not-found","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}