{"record":{"id":"7d702c6a575e4d35","repo":"dbt-labs/dbt-core","slug":"lineno-malformed-line","errorCode":null,"errorMessage":"{}:{lineno}: malformed line {:?}","messagePattern":"(.+?):(.+?): malformed line (.+?)","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/dbt-ci/src/homebrew/render.rs","lineNumber":186,"sourceCode":"/// trailing-whitespace variants). Only lines matching the tarball prefix +\n/// version are kept; wheels, zips, etc. are silently skipped.\nfn collect_tarballs_from_sha256sums(\n    path: &Path,\n    prefix: &str,\n    version: &str,\n) -> Result<Vec<Tarball>> {\n    let text = fs::read_to_string(path).with_context(|| format!(\"read {}\", path.display()))?;\n    let leader = format!(\"{prefix}{version}-\");\n    let mut out = Vec::new();\n    for (raw, lineno) in text.lines().zip(1u32..) {\n        let line = raw.trim();\n        if line.is_empty() || line.starts_with('#') {\n            continue;\n        }\n        // `<hex>  <filename>` — split on first whitespace run.\n        let mut parts = line.splitn(2, char::is_whitespace);\n        let (Some(sha), Some(rest)) = (parts.next(), parts.next()) else {\n            bail!(\"{}:{lineno}: malformed line {:?}\", path.display(), raw);\n        };\n        if sha.len() != 64 || !sha.chars().all(|c| c.is_ascii_hexdigit()) {\n            bail!(\n                \"{}:{lineno}: expected 64-char hex sha256, got {:?}\",\n                path.display(),\n                sha,\n            );\n        }\n        // `sha256sum -b` prepends a single `*` to the filename. Some\n        // implementations leave extra whitespace before the name. Strip both.\n        let trimmed = rest.trim_start();\n        let filename = trimmed.strip_prefix('*').unwrap_or(trimmed);\n        let Some(after_leader) = filename.strip_prefix(&leader) else {\n            continue;\n        };\n        let Some(target_triple) = after_leader.strip_suffix(\".tar.gz\") else {\n            continue;\n        };","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-ci/src/homebrew/render.rs#L168-L204","documentation":"collect_tarballs_from_sha256sums rejects a line of SHA256SUMS that doesn't split into a '<hash>  <filename>' pair — there is no whitespace-separated second field, so the tarball filename can't be recovered and the rendered Homebrew formula would embed a broken URL. The message includes file, line number, and the offending line.","triggerScenarios":"Thrown at crates/dbt-ci/src/homebrew/render.rs:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the SHA256SUMS line to '<64-hex>  <filename>' format","Regenerate SHA256SUMS from the actual release artifacts","Skip malformed lines with a warning if strict parsing isn't required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}