jdx/mise · error
dotfile {target} cannot declare both source and content
Error message
dotfile {target} cannot declare both source and content What it means
A dotfile entry may provision its content either from a file in the dotfiles root (`source`) or from an inline string (`content`), never both. Supplying both is ambiguous — there is no defined precedence — so preflight validation rejects the entry.
Source
Thrown at src/system/files.rs:615
}
let mode = match mode.as_deref() {
Some(value) => FileMode::parse(value).ok_or_else(|| {
eyre::eyre!("unknown dotfile mode {value:?} for {target}")
})?,
None => default_mode(),
};
if mode == FileMode::Track
&& (source.is_some()
|| content.is_some()
|| manifest.is_some()
|| exclude.is_some())
{
bail!(
"tracked file {target} cannot declare source, content, manifest, or exclude"
);
}
if source.is_some() && content.is_some() {
bail!("dotfile {target} cannot declare both source and content");
}
if mode != FileMode::Track && source.is_none() && content.is_none() {
implied_source(&resolve_target_arg(&target))?;
}
if let Some(manifest) = manifest
&& (FileManifest::parse(&manifest).is_none()
|| !matches!(mode, FileMode::Copy | FileMode::SymlinkEach))
{
bail!("invalid manifest {manifest:?} for dotfile {target}");
}
for pattern in exclude.into_iter().flatten() {
glob::Pattern::new(&pattern)?;
}
}
}
}
Ok(())
}View on GitHub (pinned to afd2eddd3a)
Solutions
- Delete either the `source` or the `content` key, keeping the one you intend to use.
- If you want inline text with the ability to fall back to a file, move the inline text into a file in the dotfiles root and reference it via `source`.
- Search all mise config files for duplicate declarations of the same target and consolidate them.
Example fix
// before [dotfiles."~/.gitconfig"] source = "gitconfig" content = "[user]\n name = x" // after [dotfiles."~/.gitconfig"] source = "gitconfig"
Defensive patterns
Strategy: validation
Validate before calling
function assertNotBothSourceAndContent(entry, target) {
if (entry.source != null && entry.content != null)
throw new Error(`${target}: cannot declare both source and content`);
} Try / catch
try {
applyDotfiles();
} catch (e) {
if (/cannot declare both source and content/.test(e.message)) {
console.error('Keep exactly one of source or content for the named target');
} else throw e;
} Prevention
- Search all config layers (global + local + env) for duplicate targets before merging
- Adopt a convention: inline content for tiny files, source for everything else
- Review dotfile diffs for both keys appearing in one table
When it happens
Trigger: Declaring `[dotfiles."~/..."]` with both `source = "..."` and `content = "..."` set in the same table.
Common situations: Merging two config files that each provisioned the same target differently, incrementally editing an entry from inline to sourced content, or copy-pasting a full example over an existing entry without removing the old key.
Related errors
- invalid dotfile declaration {target} in {}
- unknown dotfile key {key:?} for {target} in {}
- dotfile {target}: inline content does not support mode, excl
- tracked file {target} cannot declare source, content, manife
- invalid manifest {manifest:?} for dotfile {target}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/26b81651a41eb4d5.
Report an issue: GitHub.