{"record":{"id":"692b9e1a557b16c6","repo":"dbt-labs/dbt-core","slug":"download-base-url-requires-at-least-one-target","errorCode":null,"errorMessage":"--download-base-url requires at least one --target","messagePattern":"--download-base-url requires at least one --target","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/dbt-ci/src/sdist.rs","lineNumber":102,"sourceCode":"    write_targz(&sdist_path, &entries)?;\n    Ok(sdist_path)\n}\n\n/// Builds the release sdist by fetching each `--target`'s wheel from `base_url`\n/// and hashing the live bytes, so the manifest matches what installers fetch.\n#[allow(clippy::too_many_arguments)]\npub(crate) async fn build_release_sdist(\n    http: &reqwest::Client,\n    spec: &Spec,\n    version: &str,\n    base_url: &str,\n    targets: &[String],\n    python_tag: &str,\n    abi_tag: &str,\n    out_dir: &Path,\n) -> Result<PathBuf> {\n    if targets.is_empty() {\n        bail!(\"--download-base-url requires at least one --target\");\n    }\n    // Reject a non-https base url before any fetch, so we never pull wheels over\n    // an insecure transport (the assembly-time check in `build_sdist` is too late).\n    require_https(base_url)?;\n    let version_pep440 = semver_to_pep440(version)?;\n    let dist = normalize_wheel_name(&spec.wheel_name);\n    let base = base_url.trim_end_matches('/');\n\n    let mut wheels = Vec::with_capacity(targets.len());\n    for triple in targets {\n        let platform_tag = target_to_platform_tag(triple)\n            .ok_or_else(|| anyhow!(\"unsupported --target {triple:?}\"))?;\n        let filename = wheel_filename(&dist, &version_pep440, python_tag, abi_tag, &platform_tag);\n        let url = format!(\"{base}/{filename}\");\n        eprintln!(\"→ GET {url}\");\n        let bytes = download(http, &url).await?;\n        let digest = sha256_hex(bytes.as_ref());\n        eprintln!(\"✓ {filename} ({} bytes, sha256={digest})\", bytes.len());","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-ci/src/sdist.rs#L84-L120","documentation":"build_release_sdist in crates/dbt-ci/src/sdist.rs requires at least one wheel target to be specified; with an empty --target list there is nothing to download or reference from the sdist manifest, so it bails early with this CLI-argument error.","triggerScenarios":"Invoking the sdist build/publish flow with --download-base-url supplied but zero --target flags (e.g. a CI matrix that produced no targets, or a shell variable holding an empty list).","commonSituations":"A CI job parameterized over target platforms ends up with an empty list (skipped matrix, script bug); a developer forgets the --target flags when running the command locally.","solutions":["Pass at least one --target flag (e.g. --target x86_64-unknown-linux-gnu).","Fix the CI configuration/script so the target list is populated before invoking the command.","If no wheels are intended, drop --download-base-url and use the plain sdist path instead."],"exampleFix":"# before\nrelease-sdist build --download-base-url https://example.com/wheels --target \"\"\n# after\nrelease-sdist build --download-base-url https://example.com/wheels --target x86_64-unknown-linux-gnu --target aarch64-apple-darwin","handlingStrategy":"validation","validationCode":"# bash pre-check before invoking the CLI\nif [ -z \"$TARGETS\" ]; then\n  echo \"error: --download-base-url requires at least one --target\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":"if targets.is_empty() && download_base_url.is_some() {\n    anyhow::bail!(\"--download-base-url requires at least one --target\");\n}","preventionTips":["Assert the CI target matrix is non-empty before the release step.","Always pass explicit --target flags in scripts; avoid interpolating possibly-empty variables unquoted.","Skip the wheel-download path entirely when no targets are intended."],"tags":["cli","validation","build"],"backgroundTag":"missing-required-argument","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}