jdx/mise · error
dotfile cannot declare both source and content
Error message
dotfile {target} cannot declare both source and content What it means
A dotfile declaration cannot specify both `source` and `content`: an entry is either deployed from a file in the dotfiles root or written from inline content, never both. validate_incoming_files rejects the ambiguous entry up front.
Solutions
- Keep `source` and delete the `content` key if the file should come from the dotfiles root.
- Keep `content` and delete `source` if the value is inline.
- If both variants are wanted, use `variants` with per-variant sources instead.
Example fix
// before
"~/.vimrc" = { source = "dotfiles/vimrc", content = "set nocompatible" }
// after
"~/.vimrc" = { source = "dotfiles/vimrc" } Defensive patterns
Strategy: validation
Validate before calling
if entry_table.contains_key("source") && entry_table.contains_key("content") {
return Err("dotfile entry declares both source and content");
} Prevention
- Decide per entry: file from dotfiles root (source) or literal text (content), never both.
- Use variants for per-machine differences instead of duplicating source/content.
- When merging config fragments, dedupe keys for the same target.
When it happens
Trigger: validate_incoming_files parses a dotfile table containing both `source = "..."` and `content = "..."` for the same target, e.g. `"~/.vimrc" = { source = "vimrc", content = "set nocompatible" }`.
Common situations: Merging two config files that each define the same dotfile differently; a user trying to provide a fallback inline value for a source file; copy-paste editing that added content while source was still present.
Related errors
- dotfile : inline content does not support mode, exclude, or…
- invalid manifest for dotfile
- tracked file cannot declare source, content, manifest, or…
- brew-cask: command_wrapper args and env require executable
- brew-cask: command_wrapper
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/26b81651a41eb4d5.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/files.rs:727
}
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_variant_source.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)?;
}
}View on GitHub (pinned to 533346cc37)