dbt-labs/dbt-core · error · anyhow

--download-base-url requires at least one --target

Error message

--download-base-url requires at least one --target

What it means

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.

Source

Thrown at crates/dbt-ci/src/sdist.rs:102

    write_targz(&sdist_path, &entries)?;
    Ok(sdist_path)
}

/// Builds the release sdist by fetching each `--target`'s wheel from `base_url`
/// and hashing the live bytes, so the manifest matches what installers fetch.
#[allow(clippy::too_many_arguments)]
pub(crate) async fn build_release_sdist(
    http: &reqwest::Client,
    spec: &Spec,
    version: &str,
    base_url: &str,
    targets: &[String],
    python_tag: &str,
    abi_tag: &str,
    out_dir: &Path,
) -> Result<PathBuf> {
    if targets.is_empty() {
        bail!("--download-base-url requires at least one --target");
    }
    // Reject a non-https base url before any fetch, so we never pull wheels over
    // an insecure transport (the assembly-time check in `build_sdist` is too late).
    require_https(base_url)?;
    let version_pep440 = semver_to_pep440(version)?;
    let dist = normalize_wheel_name(&spec.wheel_name);
    let base = base_url.trim_end_matches('/');

    let mut wheels = Vec::with_capacity(targets.len());
    for triple in targets {
        let platform_tag = target_to_platform_tag(triple)
            .ok_or_else(|| anyhow!("unsupported --target {triple:?}"))?;
        let filename = wheel_filename(&dist, &version_pep440, python_tag, abi_tag, &platform_tag);
        let url = format!("{base}/{filename}");
        eprintln!("→ GET {url}");
        let bytes = download(http, &url).await?;
        let digest = sha256_hex(bytes.as_ref());
        eprintln!("✓ {filename} ({} bytes, sha256={digest})", bytes.len());

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Pass at least one --target flag (e.g. --target x86_64-unknown-linux-gnu).
  2. Fix the CI configuration/script so the target list is populated before invoking the command.
  3. If no wheels are intended, drop --download-base-url and use the plain sdist path instead.

Example fix

# before
release-sdist build --download-base-url https://example.com/wheels --target ""
# after
release-sdist build --download-base-url https://example.com/wheels --target x86_64-unknown-linux-gnu --target aarch64-apple-darwin
Defensive patterns

Strategy: validation

Validate before calling

# bash pre-check before invoking the CLI
if [ -z "$TARGETS" ]; then
  echo "error: --download-base-url requires at least one --target" >&2; exit 2
fi

Try / catch

if targets.is_empty() && download_base_url.is_some() {
    anyhow::bail!("--download-base-url requires at least one --target");
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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