dbt-labs/dbt-core · error · anyhow
missing required environment variable
Error message
missing required environment variable{}:
{} What it means
Publish-config resolution collected all required prefixed environment variables (e.g. *_DOMAIN, *_DOMAIN_OWNER, *_REGION, *_REPOSITORY) and one or more are unset; the message aggregates every missing name (with a pluralized suffix) after checking them all, before any network operation starts.
Solutions
- Export the listed variables in the publishing environment
- Wire them from CI secrets instead of relying on the local shell
- Re-run after fixing; resolution fails fast before any upload is attempted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/dbt-ci/src/publish.rs:86 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/0c2fe0eebe89e699.
Report an issue: GitHub.
Appendix: source
Thrown at crates/dbt-ci/src/publish.rs:86
fn resolve(prefix: &str, get: EnvGet<'_>) -> Result<Self> {
let mut missing = Vec::new();
let mut req = |suffix: &str| -> String {
let name = format!("{prefix}{suffix}");
match get(&name) {
Some(v) => v,
None => {
missing.push(name);
String::new()
}
}
};
let domain = req("_DOMAIN");
let domain_owner = req("_DOMAIN_OWNER");
let region = req("_REGION");
let repository = req("_REPOSITORY");
let profile = req("_PROFILE");
if !missing.is_empty() {
bail!(format_missing(&missing));
}
Ok(CodeArtifactTarget {
domain,
domain_owner,
region,
repository,
profile,
})
}
fn upload_url(&self) -> String {
format!(
"https://{}-{}.d.codeartifact.{}.amazonaws.com/pypi/{}/",
self.domain, self.domain_owner, self.region, self.repository,
)
}
}
View on GitHub (pinned to 0267ce9170)