{"record":{"id":"6f9ffb066b5e1ee7","repo":"jdx/mise","slug":"trust-the-configuration-before-using-its-encryptio","errorCode":null,"errorMessage":"trust the configuration before using its encryption recipients: {}","messagePattern":"trust the configuration before using its encryption recipients: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/config.rs","lineNumber":44,"sourceCode":"    pub origin: Option<OriginTomlConfig>,\n    #[serde(default)]\n    pub encryption: Option<FileEncryptionConfig>,\n}\n\n/// Public recipients shared by every encrypted dotfile.\n#[derive(Debug, Clone, Deserialize, Default)]\n#[serde(deny_unknown_fields)]\npub(crate) struct FileEncryptionConfig {\n    #[serde(default)]\n    pub recipients: Vec<String>,\n}\n\npub(crate) fn file_recipients() -> Result<Vec<String>> {\n    let mut recipients = Vec::new();\n    for (path, layer) in layers()? {\n        if let Some(encryption) = layer.encryption {\n            if !crate::config::config_file::is_trusted(&path) {\n                eyre::bail!(\n                    \"trust the configuration before using its encryption recipients: {}\",\n                    display_path(&path)\n                );\n            }\n            recipients = encryption.recipients;\n            if recipients.is_empty() {\n                eyre::bail!(\n                    \"[history.encryption].recipients must not be empty; configure recipients before capturing encrypted files\"\n                );\n            }\n        }\n    }\n    Ok(recipients)\n}\n\n/// `[history.origin]`.\n#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]\n#[serde(deny_unknown_fields)]","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/config.rs#L26-L62","documentation":"Before using `[history.encryption].recipients` from a config layer, mise checks that the config file is trusted (`crate::config::config_file::is_trusted`). If a layer declares encryption recipients but is not trusted, `file_recipients` bails so untrusted code cannot silently define who can decrypt your files.","triggerScenarios":"`file_recipients()` iterates config layers; a layer has `encryption` set but `is_trusted(&path)` returns false for that file (never run `mise trust` on it, or hash changed after edit).","commonSituations":"Cloning a repo with a mise.toml containing `[history.encryption]` and running mise before trusting the file; editing a previously-trusted config so its hash no longer matches.","solutions":["Run `mise trust <path-to-config>` to trust the config file, then retry.","Re-run trust after every edit to the config (mise re-hashes trusted files).","Remove the `[history.encryption]` block from untrusted/shared configs and keep recipients in a trusted local file."],"exampleFix":"# before\nmise history snapshot   # fails: trust the configuration ...\n# after\nmise trust mise.toml\nmise history snapshot","handlingStrategy":"validation","validationCode":"mise trust mise.toml   # run before any history/encryption operation on a new config","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always `mise trust` new configs before running mise commands","Re-trust after editing a trusted config (hash changes)","Keep [history.encryption] only in trusted, local config files"],"tags":["security","trust","encryption","config"],"backgroundTag":"authentication-required","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"}