{"record":{"id":"09436f411a53aced","repo":"jdx/mise","slug":"destination-variants-with-inline-content-are-not-supported","errorCode":null,"errorMessage":"destination variants with inline content are not supported","messagePattern":"destination variants with inline content are not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":220,"sourceCode":"}\n\n/// Validate selector combinations and destination syntax before selecting a variant.\n/// Returns a `dotfiles.root`-relative implied source for a logical entry key.\nfn validate_file_variants(\n    target: &str,\n    source: Option<&str>,\n    content: Option<&str>,\n    mode: Option<&str>,\n    variants: &[FileVariant],\n) -> Result<Option<PathBuf>> {\n    let selectors: Vec<_> = variants.iter().map(|v| v.selector.clone()).collect();\n    crate::system::history::select::validate(&selectors)?;\n    let has_target_override = variants.iter().any(|v| v.target.is_some());\n    if has_target_override && mode == Some(\"track\") {\n        bail!(\"target overrides are not supported with mode = \\\"track\\\"\");\n    }\n    if has_target_override && content.is_some() {\n        bail!(\"destination variants with inline content are not supported\");\n    }\n    let implied_source = if has_target_override && source.is_none() {\n        if !variants.iter().all(|v| v.target.is_some()) {\n            bail!(\n                \"destination variants require an explicit source when any variant uses the entry key as its target\"\n            );\n        }\n        Some(logical_source_path(target)?)\n    } else {\n        None\n    };\n    if variants.is_empty() && resolve_target_arg(target).is_relative() {\n        bail!(\"target must be absolute or start with ~/\");\n    }\n    for variant in variants {\n        let destination = variant.target.as_deref().unwrap_or(target);\n        if !variant_target_is_absolute(destination) {\n            bail!(\"variant target must be absolute or start with ~/\");","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L202-L238","documentation":"Thrown by `validate_file_variants` when a file entry defines destination variants (variants with `target` overrides) together with inline `content` on the entry. Inline content is only supported for the simple single-destination form; combining it with per-variant destinations has no well-defined meaning, so validation rejects it.","triggerScenarios":"A file entry that sets both `content = \"...\"` and has at least one variant with a `target` override (`has_target_override && content.is_some()`), seen by validate_incoming_files or merge_file_entry.","commonSituations":"Writing an inline-config entry and later adding platform variants with different destinations; templating a shared config that generates both inline content and target lists; misunderstanding that content applies per-variant.","solutions":["Move the inline content into a source file and reference it with `source`, keeping the variants.","Or drop the target overrides so the inline content targets the entry's key path.","Or split the entry: one inline-content entry plus separate variant entries without content."],"exampleFix":"// before\n[[files]]\ncontent = \"key=value\"\n[[files.variants]]\ntarget = \"~/other/loc\"\n// after\n[[files]]\nsource = \"inline-file\"\n[[files.variants]]\ntarget = \"~/other/loc\"","handlingStrategy":"validation","validationCode":"if entry.content.is_some() && entry.variants.iter().any(|v| v.target.is_some()) {\n    bail!(\"entry {} combines inline content with destination variants\", entry.key);\n}","typeGuard":"fn inline_with_variants(entry: &FileEntry) -> bool {\n    entry.content.is_some()\n        && entry.variants.iter().any(|v| v.target.is_some())\n}","tryCatchPattern":null,"preventionTips":["Use inline content only for single-destination entries.","Move multi-variant content into source files.","Document the invariant in your config template/linter."],"tags":["config","validation","dotfiles"],"backgroundTag":"conflicting-config-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"}