vectordotdev/vector · error
unknown fragment type
Error message
unknown fragment type '{}' What it means
`vdev changelog new` creates a changelog fragment file for a given fragment type. Before writing, it looks up the supplied `--type` value in the FRAGMENT_TYPES table and bails with this error when no entry matches, because no template exists to render the fragment from.
Solutions
- Run `vdev changelog new --help` (or read FRAGMENT_TYPES in vdev/src/commands/changelog/new.rs) to list valid type names
- Re-run with the exact registered type name
- If a new type is genuinely needed, add an entry to FRAGMENT_TYPES with its template
Example fix
// before vdev changelog new enchancement fix-lookup // after vdev changelog new enhancement fix-lookup
Defensive patterns
Strategy: validation
Validate before calling
const VALID_TYPES = ["enhancement","bug_fix","breaking",...]; // see FRAGMENT_TYPES
if (!VALID_TYPES.includes(type)) throw new Error(`unknown fragment type '${type}'`); Type guard
function isValidFragmentType(t) { return FRAGMENT_TYPES.some(e => e.name === t); } Try / catch
try { spawnSync("vdev", ["changelog", "new", type, slug]); } catch (e) { if (/unknown fragment type/.test(e.message)) { console.error("Valid types:", FRAGMENT_TYPES.map(t=>t.name)); } throw e; } Prevention
- Consult `vdev changelog new --help` for the live type list
- Shell-complete types instead of typing them
- Add a CI/test asserting documented type names match FRAGMENT_TYPES
When it happens
Trigger: Running `vdev changelog new <type> <slug>` where <type> does not exactly (case-sensitive) match one of the registered fragment type names in FRAGMENT_TYPES, e.g. a typo like 'enchancement' or 'bugfix' instead of 'bug_fix'.
Common situations: Typing the fragment type from memory, copying an example from an old doc before the type list changed, or using a plural/singular variant of a valid name.
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
- Failed to find validation configuration from given test…
- invalid slug ' ': only ASCII letters, digits, '_', and '-'…
- release version must be a stable semantic version
- slug must not be empty
- a sink must always have an external resource
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/b9cc0e5125783072.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/changelog/new.rs:48
pub fn exec(self) -> Result<()> {
validate_slug(&self.slug)?;
let repo_root = paths::find_repo_root()?;
let dir = repo_root.join(CHANGELOG_DIR);
if !dir.is_dir() {
bail!("{} does not exist", dir.display());
}
let file = dir.join(format!("{}.{}.md", self.slug, self.fragment_type));
if file.exists() {
bail!("{} already exists", file.display());
}
let author = detect_gh_handle().unwrap_or_else(|| TODO_HANDLE.to_string());
let Some(entry) = FRAGMENT_TYPES
.iter()
.find(|t| t.name == self.fragment_type.as_str())
else {
bail!("unknown fragment type '{}'", self.fragment_type);
};
let content = render_template(entry, &author);
fs::write(&file, content)?;
// `git add` the new fragment so the checker (which scans `git diff --diff-filter=A`)
// picks it up immediately without a manual staging step. Report the failure if it
// happens — the file is on disk, but the checker won't see it until it's staged.
let status = Command::new("git")
.args(["add", "--"])
.arg(&file)
.status()
.with_context(|| format!("failed to run `git add {}`", file.display()))?;
if !status.success() {
bail!(
"wrote {} but `git add` failed — stage it manually before running `vdev check changelog-fragments`.",
file.display()
);
}View on GitHub (pinned to bdb87aeaa4)