vectordotdev/vector · error

invalid fragment filename

Error message

invalid fragment filename '{filename}': fragment type must be one of ({}).

What it means

The fragment filename has the right shape but its middle segment is not one of the known fragment types (the FRAGMENT_TYPES registry, e.g. enhailement/new-feature/enhancement/bugfix/breaking, joined by '|'). The checker needs a known type to apply type-specific validation.

Solutions

  1. Rename the file using a supported type: pick one from the list printed in the error message.
  2. Run the fragment scaffolder to create a correctly typed file.
  3. If the type seems legitimately missing, check whether this Vector version renamed the fragment types.

Example fix

// before
changelog.d/jdoe.feature.md
// after
changelog.d/jdoe.new-feature.md
Defensive patterns

Strategy: validation

Validate before calling

const FRAGMENT_TYPES: [&str; 5] = ["new-feature", "enhancement", "bugfix", "breaking", "deprecation"];
let name = "jdoe.feature.md";
let ty = name.split('.').nth(1).unwrap();
assert!(FRAGMENT_TYPES.contains(&ty), "unknown fragment type: {ty}");

Prevention

When it happens

Trigger: Running `vdev check changelog-fragments` with a file like `jdoe.typo-fix.md` or `jdoe.feature.md` where `typo-fix`/`feature` is not in FRAGMENT_TYPES.

Common situations: Guessing the fragment type name instead of using the scaffolder's options; copying a convention from another project; a type name that was renamed in a newer Vector version.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/aa6b48e51e12105a. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/check/changelog_fragments.rs:175

        CHANGELOG_DIR,
    ])?;
    Ok(out
        .lines()
        .filter(|l| !l.trim().is_empty())
        .map(PathBuf::from)
        .collect())
}

fn validate_filename(filename: &str) -> Result<&'static FragmentType> {
    let parts: Vec<&str> = filename.split('.').collect();
    if parts.len() != 3 {
        bail!(
            "invalid fragment filename '{filename}': expected '<unique_name>.<fragment_type>.md'"
        );
    }
    let fragment_type = parts[1];
    let Some(known) = FRAGMENT_TYPES.iter().find(|t| t.name == fragment_type) else {
        bail!(
            "invalid fragment filename '{filename}': fragment type must be one of ({}).",
            FRAGMENT_TYPES
                .iter()
                .map(|t| t.name)
                .collect::<Vec<_>>()
                .join("|")
        );
    };
    if parts[2] != "md" {
        bail!("invalid fragment filename '{filename}': extension must be markdown (.md).");
    }
    Ok(known)
}

fn validate_contents(
    path: &std::path::Path,
    filename: &str,
    fragment_type: &FragmentType,

View on GitHub (pinned to bdb87aeaa4)