{"record":{"id":"26b81651a41eb4d5","repo":"jdx/mise","slug":"dotfile-target-cannot-declare-both-source-and-co","errorCode":null,"errorMessage":"dotfile {target} cannot declare both source and content","messagePattern":"dotfile (.+?) cannot declare both source and content","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":727,"sourceCode":"                }\n                let mode = match mode.as_deref() {\n                    Some(value) => FileMode::parse(value).ok_or_else(|| {\n                        eyre::eyre!(\"unknown dotfile mode {value:?} for {target}\")\n                    })?,\n                    None => default_mode(),\n                };\n                if mode == FileMode::Track\n                    && (source.is_some()\n                        || content.is_some()\n                        || manifest.is_some()\n                        || exclude.is_some())\n                {\n                    bail!(\n                        \"tracked file {target} cannot declare source, content, manifest, or exclude\"\n                    );\n                }\n                if source.is_some() && content.is_some() {\n                    bail!(\"dotfile {target} cannot declare both source and content\");\n                }\n                if mode != FileMode::Track\n                    && source.is_none()\n                    && content.is_none()\n                    && implied_variant_source.is_none()\n                {\n                    implied_source(&resolve_target_arg(&target))?;\n                }\n                if let Some(manifest) = manifest\n                    && (FileManifest::parse(&manifest).is_none()\n                        || !matches!(mode, FileMode::Copy | FileMode::SymlinkEach))\n                {\n                    bail!(\"invalid manifest {manifest:?} for dotfile {target}\");\n                }\n                for pattern in exclude.into_iter().flatten() {\n                    glob::Pattern::new(&pattern)?;\n                }\n            }","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L709-L745","documentation":"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.","triggerScenarios":"validate_incoming_files parses a dotfile table containing both `source = \"...\"` and `content = \"...\"` for the same target, e.g. `\"~/.vimrc\" = { source = \"vimrc\", content = \"set nocompatible\" }`.","commonSituations":"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.","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."],"exampleFix":"// before\n\"~/.vimrc\" = { source = \"dotfiles/vimrc\", content = \"set nocompatible\" }\n// after\n\"~/.vimrc\" = { source = \"dotfiles/vimrc\" }","handlingStrategy":"validation","validationCode":"if entry_table.contains_key(\"source\") && entry_table.contains_key(\"content\") {\n    return Err(\"dotfile entry declares both source and content\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["dotfiles","config-validation","mise"],"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"}