vectordotdev/vector · error
Fragment path is not valid UTF-8
Error message
Fragment path is not valid UTF-8: {} What it means
lookup_pull_requests_from_git converts a fragment's repository-relative path into a &str so it can be embedded in a git log grep pattern. If the path contains bytes that are not valid UTF-8, to_str() fails and this error is thrown instead of silently proceeding with a bad pattern.
Solutions
- Find and rename the non-UTF-8 filename in the changelog.d directory (e.g. `convmv --notest -f latin1 -t utf8 changelog.d/*`).
- Regenerate the fragment filename in plain ASCII/UTF-8 before running the release step.
- Re-run the release command after the rename.
Example fix
// before git mv $'changelog.d/fix\xff.md' 'changelog.d/fix.md' // after mv 'changelog.d/fix.md' 'changelog.d/fix.md' # valid UTF-8 name
Defensive patterns
Strategy: validation
Validate before calling
let name = fragment_path.to_str();
assert!(name.is_some(), "fragment path must be UTF-8: {:?}", fragment_path); Type guard
fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() } Prevention
- Create fragment files with editor/shell defaults that use UTF-8
- Avoid copying fragments from archives or filesystems with legacy encodings
- Lint changelog.d filenames in CI for UTF-8 validity
When it happens
Trigger: Calling lookup_pull_requests (during release CUE generation) with a fragment path whose relative path (after stripping the repo root) is not valid UTF-8.
Common situations: A changelog fragment was created with a filename containing raw or escaped bytes from another tool/OS; a merge artifact copied a non-UTF-8 name into changelog.d.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- failed to turn path into string
- Bad fragment filename
- Failed to convert OsStr to &str for
- Failed to find validation configuration from given test…
- Failed to get metadata for
AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16).
Data as JSON: /api/errors/791d939e8ebd4538.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/release/generate_cue.rs:432
pull_request_metadata: PullRequestMetadata,
) -> Result<Vec<u64>> {
lookup_pull_requests_from_git(repo_root, fragment_path, pull_request_metadata)
}
fn lookup_pull_requests_from_git(
repo_root: &Path,
fragment_path: &Path,
pull_request_metadata: PullRequestMetadata,
) -> Result<Vec<u64>> {
let relative_path = fragment_path.strip_prefix(repo_root).with_context(|| {
format!(
"Fragment path {} is outside the repository root {}",
fragment_path.display(),
repo_root.display()
)
})?;
let relative_path = relative_path.to_str().ok_or_else(|| {
anyhow!(
"Fragment path is not valid UTF-8: {}",
fragment_path.display()
)
})?;
let addition_commits = run_command(
"git",
&[
"log",
"--format=%H",
"--diff-filter=A",
"--follow",
"--",
relative_path,
],
repo_root,
)?;
let Some(latest_addition) = addition_commits.lines().next() else {View on GitHub (pinned to 0d4ab78a4f)