{"record":{"id":"b9cc0e5125783072","repo":"vectordotdev/vector","slug":"unknown-fragment-type","errorCode":null,"errorMessage":"unknown fragment type '{}'","messagePattern":"unknown fragment type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/changelog/new.rs","lineNumber":48,"sourceCode":"    pub fn exec(self) -> Result<()> {\n        validate_slug(&self.slug)?;\n\n        let repo_root = paths::find_repo_root()?;\n        let dir = repo_root.join(CHANGELOG_DIR);\n        if !dir.is_dir() {\n            bail!(\"{} does not exist\", dir.display());\n        }\n        let file = dir.join(format!(\"{}.{}.md\", self.slug, self.fragment_type));\n        if file.exists() {\n            bail!(\"{} already exists\", file.display());\n        }\n\n        let author = detect_gh_handle().unwrap_or_else(|| TODO_HANDLE.to_string());\n        let Some(entry) = FRAGMENT_TYPES\n            .iter()\n            .find(|t| t.name == self.fragment_type.as_str())\n        else {\n            bail!(\"unknown fragment type '{}'\", self.fragment_type);\n        };\n        let content = render_template(entry, &author);\n        fs::write(&file, content)?;\n\n        // `git add` the new fragment so the checker (which scans `git diff --diff-filter=A`)\n        // picks it up immediately without a manual staging step. Report the failure if it\n        // happens — the file is on disk, but the checker won't see it until it's staged.\n        let status = Command::new(\"git\")\n            .args([\"add\", \"--\"])\n            .arg(&file)\n            .status()\n            .with_context(|| format!(\"failed to run `git add {}`\", file.display()))?;\n        if !status.success() {\n            bail!(\n                \"wrote {} but `git add` failed — stage it manually before running `vdev check changelog-fragments`.\",\n                file.display()\n            );\n        }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/changelog/new.rs#L30-L66","documentation":"`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.","triggerScenarios":"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'.","commonSituations":"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.","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"],"exampleFix":"// before\nvdev changelog new enchancement fix-lookup\n// after\nvdev changelog new enhancement fix-lookup","handlingStrategy":"validation","validationCode":"const VALID_TYPES = [\"enhancement\",\"bug_fix\",\"breaking\",...]; // see FRAGMENT_TYPES\nif (!VALID_TYPES.includes(type)) throw new Error(`unknown fragment type '${type}'`);","typeGuard":"function isValidFragmentType(t) { return FRAGMENT_TYPES.some(e => e.name === t); }","tryCatchPattern":"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; }","preventionTips":["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"],"tags":["cli","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}