dbt-labs/dbt-core · error · anyhow

: : expected 64-char hex sha256, got

Error message

{}:{lineno}: expected 64-char hex sha256, got {:?}

What it means

collect_tarballs_from_sha256sums validation failure: the first whitespace-delimited token on the line is not a 64-character hexadecimal sha256 digest, so the checksum cannot be verified or embedded in the formula. Usually a truncated, wrapped, or hand-typed checksum line.

Solutions

  1. Correct the digest to the full 64-character lowercase hex string
  2. Recompute the file with sha256sum and regenerate SHA256SUMS
  3. Check the line wasn't wrapped or truncated by an editor
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-ci/src/homebrew/render.rs:189 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/a36f52f99bde7b07. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-ci/src/homebrew/render.rs:189

    path: &Path,
    prefix: &str,
    version: &str,
) -> Result<Vec<Tarball>> {
    let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?;
    let leader = format!("{prefix}{version}-");
    let mut out = Vec::new();
    for (raw, lineno) in text.lines().zip(1u32..) {
        let line = raw.trim();
        if line.is_empty() || line.starts_with('#') {
            continue;
        }
        // `<hex>  <filename>` — split on first whitespace run.
        let mut parts = line.splitn(2, char::is_whitespace);
        let (Some(sha), Some(rest)) = (parts.next(), parts.next()) else {
            bail!("{}:{lineno}: malformed line {:?}", path.display(), raw);
        };
        if sha.len() != 64 || !sha.chars().all(|c| c.is_ascii_hexdigit()) {
            bail!(
                "{}:{lineno}: expected 64-char hex sha256, got {:?}",
                path.display(),
                sha,
            );
        }
        // `sha256sum -b` prepends a single `*` to the filename. Some
        // implementations leave extra whitespace before the name. Strip both.
        let trimmed = rest.trim_start();
        let filename = trimmed.strip_prefix('*').unwrap_or(trimmed);
        let Some(after_leader) = filename.strip_prefix(&leader) else {
            continue;
        };
        let Some(target_triple) = after_leader.strip_suffix(".tar.gz") else {
            continue;
        };
        out.push(Tarball {
            target_triple: target_triple.to_string(),
            filename: filename.to_string(),

View on GitHub (pinned to 0267ce9170)