{"record":{"id":"9af9cdf192a81362","repo":"jdx/mise","slug":"encrypted-dotfile-target-requires-an-external-so","errorCode":null,"errorMessage":"encrypted dotfile {target} requires an external source, not inline content or edits","messagePattern":"encrypted dotfile (.+?) requires an external source, not inline content or edits","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":647,"sourceCode":"pub(crate) fn validate_incoming_files(config_files: &ConfigMap) -> Result<()> {\n    for (path, config) in config_files {\n        let Some(dotfiles) = config.dotfiles_config() else {\n            continue;\n        };\n        for (target, value) in dotfiles.0 {\n            if value.as_table().is_some_and(|t| {\n                t.contains_key(\"encrypt\")\n                    && t.get(\"encrypt\").and_then(toml::Value::as_bool).is_none()\n            }) {\n                bail!(\"dotfile {target}: encrypt must be a boolean\");\n            }\n            if value.as_table().is_some_and(|t| {\n                t.get(\"encrypt\").and_then(toml::Value::as_bool) == Some(true)\n                    && [\"content\", \"block\", \"line\", \"template\"]\n                        .iter()\n                        .any(|key| t.contains_key(*key))\n            }) {\n                bail!(\n                    \"encrypted dotfile {target} requires an external source, not inline content or edits\"\n                );\n            }\n            let Some(entry) = file_entry_from_toml(&target, value.clone()) else {\n                // Managed line/block edits are handled by the edit engine,\n                // not by this whole-file declaration parser.\n                if value.as_table().is_some_and(|table| {\n                    [\"block\", \"line\", \"template\", \"comment\", \"position\"]\n                        .iter()\n                        .any(|key| table.contains_key(*key))\n                }) {\n                    continue;\n                }\n                bail!(\"invalid dotfile declaration {target} in {}\", path.display());\n            };\n            if let Some(table) = value.as_table() {\n                for key in table.keys() {\n                    if !matches!(","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L629-L665","documentation":"Encryption applies to files loaded from an external `source`. If a dotfile entry sets `encrypt = true` but also provides inline `content`, or block/line/template edits (`block`, `line`, `template` keys), there is no single external file body to encrypt, so `validate_incoming_files` rejects the combination.","triggerScenarios":"An entry like `\"~/.x\" = { encrypt = true, content = \"...\" }` or `encrypt = true` together with `block`/`line`/`template` edit directives.","commonSituations":"Users wanting to encrypt managed line edits or templated files; combining an encryption flag copied from one example with an inline-content example.","solutions":["Move the content into a real file and set `source` instead of inline `content`, keeping `encrypt = true`","Remove `encrypt = true` if inline content or edits are the actual intent","Apply edits to the sourced file before encryption rather than declaring them on the encrypted entry"],"exampleFix":"// before\n\"~/.netrc\" = { encrypt = true, content = \"machine x login y\" }\n// after\n\"~/.netrc\" = { source = \"dotfiles/netrc\", encrypt = true }","handlingStrategy":"validation","validationCode":"const INLINE_KEYS = ['content','block','line','template'];\nfunction encryptionConflict(entry) {\n  return entry?.encrypt === true && INLINE_KEYS.some(k => k in entry);\n}","typeGuard":"const isExternalEncrypted = (e: any) => e?.encrypt === true && typeof e?.source === 'string' && e.content === undefined;","tryCatchPattern":null,"preventionTips":["Use `encrypt` only with a `source` pointing at a real file","Keep inline `content` and edit directives unencrypted"],"tags":["config","dotfiles","mutually-exclusive"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}