vectordotdev/vector · error
failed to turn path into string
Error message
failed to turn path into string: {} What it means
After globbing artifacts, the command converts each path's OsString into a Rust String to pass to the `gh` CLI. Non-UTF-8 artifact filenames cannot be converted, so this error is raised rather than passing a lossy/garbled name to gh.
Solutions
- List target/artifacts and rename any non-UTF-8 filenames (`convmv -f latin1 -t utf8 target/artifacts/*`).
- Fix the packaging step that creates the artifact names to emit plain UTF-8/ASCII names.
- Clean target/artifacts and regenerate artifacts, then re-run `vdev release github`.
Example fix
// before artifact named 'bundle\xff.tar.gz' in target/artifacts/ // after mv target/artifacts/bundle*.tar.gz target/artifacts/bundle.tar.gz # valid UTF-8
Defensive patterns
Strategy: validation
Validate before calling
for p in std::fs::read_dir("target/artifacts")? {
let p = p?.path();
assert!(p.to_str().is_some(), "non-UTF-8 artifact name: {p:?}");
} Type guard
fn has_utf8_name(p: &std::path::Path) -> bool { p.to_str().is_some() } Prevention
- Generate artifact names from sanitized ASCII inputs
- Reject non-UTF-8 filenames in the packaging script
- Clean and regenerate target/artifacts before releasing
When it happens
Trigger: Running `vdev release github` when a file under target/artifacts/ has a name containing invalid UTF-8 bytes (e.g. produced by a build tool embedding raw bytes into a filename).
Common situations: A packaging script generates artifact names from untrusted/legacy-encoded input; test fixture names with unusual bytes copied into target/artifacts; locale-related encoding issues in CI.
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
- Fragment path is not valid UTF-8
- 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@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/0f913e098a8fd598.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/release/github.rs:20
use anyhow::{Ok, Result, anyhow};
use glob::glob;
use std::process::Command;
/// Uploads target/artifacts to GitHub releases
#[derive(clap::Args, Debug)]
#[command()]
pub struct Cli {}
impl Cli {
pub fn exec(self) -> Result<()> {
let artifacts = glob("target/artifacts/*")
.expect("failed to read glob pattern")
.collect::<Result<Vec<_>, _>>()
.map_err(|e| anyhow!("failed to read path: {e}"))?
.into_iter()
.map(|p| p.into_os_string().into_string())
.collect::<Result<Vec<_>, _>>()
.map_err(|e| anyhow!("failed to turn path into string: {}", e.to_string_lossy()))?;
let version = cargo::get_version()?;
let mut command = Command::new("gh");
command.in_repo();
command.args(
[
"release",
"--repo",
"vectordotdev/vector",
"create",
&format!("v{version}"),
"--title",
&format!("v{version}"),
"--notes",
&format!(
"The [COSE team](https://opensource.datadoghq.com/about/#the-community-open-source-engineering-team) is excited to announce version `{version}`! 🚀\n\n[View release notes](https://vector.dev/releases/{version})"
),
]View on GitHub (pinned to bdb87aeaa4)