dbt-labs/dbt-core · error · anyhow

non-UTF8 distribution filename

Error message

non-UTF8 distribution filename: {}

What it means

upload_dist rejects a distribution artifact whose file name is not valid UTF-8: it cannot be placed into the multipart filename field nor parsed for name/version tags, so the upload is refused before any metadata is read.

Solutions

  1. Rename the artifact to a clean ASCII/UTF-8 filename before uploading
  2. Rebuild the wheel/sdist so tooling produces a well-formed name
  3. Reject the file with this error rather than lossily converting bytes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-ci/src/publish.rs:349 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/507dbdb5e1d3b268. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-ci/src/publish.rs:349

        .user_agent(concat!("dbt-ci/", env!("CARGO_PKG_VERSION")))
        .build()
        .context("build http client")
}

/// Mirrors twine's upload payload, reading metadata from the artifact's
/// METADATA/PKG-INFO. Handles both wheels and sdists.
async fn upload_dist(
    http: &reqwest::Client,
    url: &str,
    user: &str,
    password: &str,
    dist: &Path,
    kind: DistKind,
) -> Result<()> {
    let filename = dist
        .file_name()
        .and_then(|s| s.to_str())
        .ok_or_else(|| anyhow!("non-UTF8 distribution filename: {}", dist.display()))?
        .to_string();

    let metadata = Distribution::new(dist)
        .with_context(|| format!("read metadata from {}", dist.display()))?
        .metadata()
        .clone();

    // Wheels carry name/version/pyversion in the filename; the sdist's from PKG-INFO.
    let (parsed, filetype) = match kind {
        DistKind::Wheel => {
            let parsed = parse_wheel_filename(&filename)
                .ok_or_else(|| anyhow!("wheel filename not in PEP 491 form: {filename}"))?;
            (parsed, "bdist_wheel")
        }
        DistKind::Sdist => (
            ParsedWheel {
                name: metadata.name.clone(),
                version: metadata.version.clone(),

View on GitHub (pinned to 0267ce9170)