dbt-labs/dbt-core · error

clap requires --version with --download-base-url

Error message

clap requires --version with --download-base-url

What it means

Invariant expect in build_only_sdist: clap's `requires` chain (--sdist-out requires --download-base-url requires --version) guarantees --version is present when this code runs, so the unwrap cannot fail unless the clap definitions drift from this assumption. Internal consistency guard only.

Solutions

  1. Keep the clap requires chain aligned with the expects here
  2. Cover the build-only sdist path with a CLI test passing all required flags
  3. Report as an internal bug in dbt-ci publish
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-ci/src/publish.rs:199 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/3195b351edc94ed8. Report an issue: GitHub.

Appendix: source

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

}

/// Builds the download-at-install sdist into `out_dir` without uploading it.
async fn build_only_sdist(
    args: &PypiPublishArgs,
    spec: &pyproject::Spec,
    out_dir: &Path,
) -> Result<()> {
    let http = http_client()?;
    // clap's `requires` guarantees `--version` alongside `--download-base-url`,
    // which `--sdist-out` also requires.
    let base_url = args
        .download_base_url
        .as_deref()
        .context("--sdist-out requires --download-base-url")?;
    let version = args
        .version
        .as_deref()
        .expect("clap requires --version with --download-base-url");
    fs::create_dir_all(out_dir)
        .with_context(|| format!("create sdist out dir {}", out_dir.display()))?;
    let sdist = build_release_sdist(
        &http,
        spec,
        version,
        base_url,
        &args.targets,
        &args.python_tag,
        &args.abi_tag,
        out_dir,
    )
    .await?;
    eprintln!("✓ sdist: {}", sdist.display());
    Ok(())
}

/// Resolves what to publish — a freshly-built sdist (`--download-base-url`) or

View on GitHub (pinned to 0267ce9170)