{"record":{"id":"7638f18a3c918177","repo":"vectordotdev/vector","slug":"unexpected-fragment-path","errorCode":null,"errorMessage":"Unexpected fragment path: {}","messagePattern":"Unexpected fragment path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/check/changelog_fragments.rs","lineNumber":74,"sourceCode":"            );\n        }\n        if added_real.len() > self.max_fragments {\n            bail!(\n                \"Too many changelog fragments ({} > {}).\",\n                added_real.len(),\n                self.max_fragments\n            );\n        }\n\n        // Every touched fragment (added or modified) must pass the schema check.\n        let modified: Vec<PathBuf> = diff_fragments(&self.merge_base, \"M\")?\n            .into_iter()\n            .filter(is_real_fragment)\n            .collect();\n        let expected_parent = std::path::Path::new(CHANGELOG_DIR);\n        for path in added_real.iter().chain(modified.iter()) {\n            let Some(name) = path.file_name().and_then(|s| s.to_str()) else {\n                bail!(\"Unexpected fragment path: {}\", path.display());\n            };\n            if path.parent() != Some(expected_parent) {\n                bail!(\n                    \"invalid fragment path '{}': fragments must live directly under {CHANGELOG_DIR}/, not in a subdirectory.\",\n                    path.display()\n                );\n            }\n            info!(\"Validating '{name}'\");\n            let fragment_type = validate_filename(name)?;\n            validate_contents(&repo_root.join(path), name, fragment_type)?;\n        }\n\n        // Cross-fragment check: derived-or-explicit anchors across every breaking fragment\n        // currently in `changelog.d/` must be unique and non-empty. Catches conflicts at CI\n        // time rather than at release time (when a partial CUE may already exist).\n        validate_breaking_anchor_set(&changelog_dir)?;\n\n        info!(\"changelog additions are valid.\");","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/check/changelog_fragments.rs#L56-L92","documentation":"For every added or modified fragment, the checker extracts the file name to validate it. If the diff reports a path with no usable file name (e.g. a directory entry or a path that is not valid UTF-8 as a file name), it cannot proceed and bails with this error.","triggerScenarios":"`git diff --name-only` yields a fragment path whose final component is not valid UTF-8 (non-ASCII bytes) or is empty/directory-like, and that path survived the is_real_fragment filter.","commonSituations":"Creating a fragment file with non-UTF-8 characters in its name (e.g. via a script or copy-paste of unicode); tooling that stages directory paths instead of files.","solutions":["Find the offending staged path: `git diff --name-only --diff-filter=A <merge-base>` and look for weird/non-UTF-8 names","Rename or remove the bad file: `git rm --cached '<bad path>'` and re-create it with an ASCII slug via `vdev changelog new`","Avoid non-ASCII filenames in changelog.d/"],"exampleFix":"# before\nchangelog.d/fülltext_fix.md  # non-UTF-8-safe pipeline chokes\n# after\ngit mv \"changelog.d/fülltext_fix.md\" changelog.d/fulltext_fix.md","handlingStrategy":"validation","validationCode":"for (const f of addedFragments) { if (!path.basename(f)) throw new Error(`unexpected fragment path: ${f}`); }","typeGuard":"const hasFileName = (p) => Boolean(path.basename(p)) && Buffer.from(path.basename(p), \"utf8\").toString(\"utf8\") === path.basename(p);","tryCatchPattern":"try { runCheck(); } catch (e) { if (/Unexpected fragment path/.test(e.message)) { renameBadFragmentFile(e.message); } throw e; }","preventionTips":["Use ASCII filenames in changelog.d/","Stage files, not directories (`git add changelog.d/foo.md`)","Avoid unicode filenames produced by copy-paste tools"],"tags":["git","filesystem","encoding"],"backgroundTag":"invalid-identifier-format","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"}