{"record":{"id":"0f913e098a8fd598","repo":"vectordotdev/vector","slug":"failed-to-turn-path-into-string","errorCode":null,"errorMessage":"failed to turn path into string: {}","messagePattern":"failed to turn path into string: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/release/github.rs","lineNumber":20,"sourceCode":"use anyhow::{Ok, Result, anyhow};\nuse glob::glob;\nuse std::process::Command;\n\n/// Uploads target/artifacts to GitHub releases\n#[derive(clap::Args, Debug)]\n#[command()]\npub struct Cli {}\n\nimpl Cli {\n    pub fn exec(self) -> Result<()> {\n        let artifacts = glob(\"target/artifacts/*\")\n            .expect(\"failed to read glob pattern\")\n            .collect::<Result<Vec<_>, _>>()\n            .map_err(|e| anyhow!(\"failed to read path: {e}\"))?\n            .into_iter()\n            .map(|p| p.into_os_string().into_string())\n            .collect::<Result<Vec<_>, _>>()\n            .map_err(|e| anyhow!(\"failed to turn path into string: {}\", e.to_string_lossy()))?;\n\n        let version = cargo::get_version()?;\n        let mut command = Command::new(\"gh\");\n        command.in_repo();\n        command.args(\n            [\n                \"release\",\n                \"--repo\",\n                \"vectordotdev/vector\",\n                \"create\",\n                &format!(\"v{version}\"),\n                \"--title\",\n                &format!(\"v{version}\"),\n                \"--notes\",\n                &format!(\n                    \"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})\"\n                ),\n            ]","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/release/github.rs#L2-L38","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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`."],"exampleFix":"// before\nartifact named 'bundle\\xff.tar.gz' in target/artifacts/\n// after\nmv target/artifacts/bundle*.tar.gz target/artifacts/bundle.tar.gz  # valid UTF-8","handlingStrategy":"validation","validationCode":"for p in std::fs::read_dir(\"target/artifacts\")? {\n    let p = p?.path();\n    assert!(p.to_str().is_some(), \"non-UTF-8 artifact name: {p:?}\");\n}","typeGuard":"fn has_utf8_name(p: &std::path::Path) -> bool { p.to_str().is_some() }","tryCatchPattern":null,"preventionTips":["Generate artifact names from sanitized ASCII inputs","Reject non-UTF-8 filenames in the packaging script","Clean and regenerate target/artifacts before releasing"],"tags":["rust","cli","encoding"],"backgroundTag":"invalid-argument-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"}