jdx/mise · error

encrypted dotfile requires an external source, not inline…

Error message

encrypted dotfile {target} requires an external source, not inline content or edits

What it means

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.

Solutions

  1. Move the content into a real file and set `source` instead of inline `content`, keeping `encrypt = true`
  2. Remove `encrypt = true` if inline content or edits are the actual intent
  3. Apply edits to the sourced file before encryption rather than declaring them on the encrypted entry

Example fix

// before
"~/.netrc" = { encrypt = true, content = "machine x login y" }
// after
"~/.netrc" = { source = "dotfiles/netrc", encrypt = true }
Defensive patterns

Strategy: validation

Validate before calling

const INLINE_KEYS = ['content','block','line','template'];
function encryptionConflict(entry) {
  return entry?.encrypt === true && INLINE_KEYS.some(k => k in entry);
}

Type guard

const isExternalEncrypted = (e: any) => e?.encrypt === true && typeof e?.source === 'string' && e.content === undefined;

Prevention

When it happens

Trigger: An entry like `"~/.x" = { encrypt = true, content = "..." }` or `encrypt = true` together with `block`/`line`/`template` edit directives.

Common situations: Users wanting to encrypt managed line edits or templated files; combining an encryption flag copied from one example with an inline-content example.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/9af9cdf192a81362. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:647

pub(crate) fn validate_incoming_files(config_files: &ConfigMap) -> Result<()> {
    for (path, config) in config_files {
        let Some(dotfiles) = config.dotfiles_config() else {
            continue;
        };
        for (target, value) in dotfiles.0 {
            if value.as_table().is_some_and(|t| {
                t.contains_key("encrypt")
                    && t.get("encrypt").and_then(toml::Value::as_bool).is_none()
            }) {
                bail!("dotfile {target}: encrypt must be a boolean");
            }
            if value.as_table().is_some_and(|t| {
                t.get("encrypt").and_then(toml::Value::as_bool) == Some(true)
                    && ["content", "block", "line", "template"]
                        .iter()
                        .any(|key| t.contains_key(*key))
            }) {
                bail!(
                    "encrypted dotfile {target} requires an external source, not inline content or edits"
                );
            }
            let Some(entry) = file_entry_from_toml(&target, value.clone()) else {
                // Managed line/block edits are handled by the edit engine,
                // not by this whole-file declaration parser.
                if value.as_table().is_some_and(|table| {
                    ["block", "line", "template", "comment", "position"]
                        .iter()
                        .any(|key| table.contains_key(*key))
                }) {
                    continue;
                }
                bail!("invalid dotfile declaration {target} in {}", path.display());
            };
            if let Some(table) = value.as_table() {
                for key in table.keys() {
                    if !matches!(

View on GitHub (pinned to 533346cc37)