{"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":615,"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 && source.is_none() && content.is_none() {\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            }\n        }\n    }\n    Ok(())\n}","sourceCodeStart":597,"sourceCodeEnd":633,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/files.rs#L597-L633","documentation":"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.","triggerScenarios":"Declaring `[dotfiles.\"~/...\"]` with both `source = \"...\"` and `content = \"...\"` set in the same table.","commonSituations":"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.","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."],"exampleFix":"// before\n[dotfiles.\"~/.gitconfig\"]\nsource = \"gitconfig\"\ncontent = \"[user]\\n  name = x\"\n\n// after\n[dotfiles.\"~/.gitconfig\"]\nsource = \"gitconfig\"","handlingStrategy":"validation","validationCode":"function assertNotBothSourceAndContent(entry, target) {\n  if (entry.source != null && entry.content != null)\n    throw new Error(`${target}: cannot declare both source and content`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  applyDotfiles();\n} catch (e) {\n  if (/cannot declare both source and content/.test(e.message)) {\n    console.error('Keep exactly one of source or content for the named target');\n  } else throw e;\n}","preventionTips":["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"],"tags":["dotfiles","config-validation","mutually-exclusive","mise"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}