jdx/mise · error

destination variants with inline content are not supported

Error message

destination variants with inline content are not supported

What it means

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.

Solutions

  1. Move the inline content into a source file and reference it with `source`, keeping the variants.
  2. Or drop the target overrides so the inline content targets the entry's key path.
  3. Or split the entry: one inline-content entry plus separate variant entries without content.

Example fix

// before
[[files]]
content = "key=value"
[[files.variants]]
target = "~/other/loc"
// after
[[files]]
source = "inline-file"
[[files.variants]]
target = "~/other/loc"
Defensive patterns

Strategy: validation

Validate before calling

if entry.content.is_some() && entry.variants.iter().any(|v| v.target.is_some()) {
    bail!("entry {} combines inline content with destination variants", entry.key);
}

Type guard

fn inline_with_variants(entry: &FileEntry) -> bool {
    entry.content.is_some()
        && entry.variants.iter().any(|v| v.target.is_some())
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/09436f411a53aced. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:220

}

/// Validate selector combinations and destination syntax before selecting a variant.
/// Returns a `dotfiles.root`-relative implied source for a logical entry key.
fn validate_file_variants(
    target: &str,
    source: Option<&str>,
    content: Option<&str>,
    mode: Option<&str>,
    variants: &[FileVariant],
) -> Result<Option<PathBuf>> {
    let selectors: Vec<_> = variants.iter().map(|v| v.selector.clone()).collect();
    crate::system::history::select::validate(&selectors)?;
    let has_target_override = variants.iter().any(|v| v.target.is_some());
    if has_target_override && mode == Some("track") {
        bail!("target overrides are not supported with mode = \"track\"");
    }
    if has_target_override && content.is_some() {
        bail!("destination variants with inline content are not supported");
    }
    let implied_source = if has_target_override && source.is_none() {
        if !variants.iter().all(|v| v.target.is_some()) {
            bail!(
                "destination variants require an explicit source when any variant uses the entry key as its target"
            );
        }
        Some(logical_source_path(target)?)
    } else {
        None
    };
    if variants.is_empty() && resolve_target_arg(target).is_relative() {
        bail!("target must be absolute or start with ~/");
    }
    for variant in variants {
        let destination = variant.target.as_deref().unwrap_or(target);
        if !variant_target_is_absolute(destination) {
            bail!("variant target must be absolute or start with ~/");

View on GitHub (pinned to 533346cc37)