dbt-labs/dbt-core · error
formula file not found: {}
Error message
formula file not found: {} What it means
`dbt-ci homebrew publish` verifies early in `run` that the `--formula` argument points at an existing file before attempting to publish a Homebrew formula. If the path does not exist or is a directory, the command aborts with `bail!("formula file not found: ...")`. This is a fail-fast input validation to avoid publishing garbage or failing later in the pipeline.
Source
Thrown at crates/dbt-ci/src/homebrew/publish.rs:43
use std::fs;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitCode, Stdio};
pub fn execute(args: HomebrewPublishArgs) -> ExitCode {
match run(args) {
Ok(()) => ExitCode::SUCCESS,
Err(e) => {
eprintln!("error: {e:#}");
ExitCode::from(2)
}
}
}
fn run(args: HomebrewPublishArgs) -> Result<()> {
validate_release_version(&args.version)
.with_context(|| format!("invalid --version {:?}", args.version))?;
if !args.formula.is_file() {
bail!("formula file not found: {}", args.formula.display());
}
let filename = args
.formula
.file_name()
.and_then(|s| s.to_str())
.ok_or_else(|| anyhow!("formula path has no filename: {}", args.formula.display()))?
.to_string();
if !filename.ends_with(".rb") {
bail!("formula filename does not end in .rb: {filename}");
}
let token = read_token(&args.token_env, args.dry_run)?;
// For HTTPS tap URLs, build an `http.extraHeader` config knob carrying
// Basic auth credentials. Non-HTTPS URLs (file://, ssh) carry their
// own auth.
let auth_args = build_auth_args(&args.tap_repo, token.as_deref());
let work = TempDir::new("dbt-ci-brew-publish")?;View on GitHub (pinned to 0267ce9170)
Solutions
- Verify the path passed to `--formula` exists: run `ls -l <path>` and correct any typo.
- If using a relative path, run the command from the directory where the formula lives, or pass an absolute path.
- Confirm the CI job actually checked out the repository containing the formula before running publish.
Example fix
// before dbt-ci homebrew publish --formula Formula/dbt.rb # run from wrong cwd // after dbt-ci homebrew publish --formula /abs/path/to/repo/Formula/dbt.rb
Defensive patterns
Strategy: validation
Validate before calling
use std::path::Path;
fn validate_formula_path(p: &Path) -> Result<(), String> {
if !p.is_file() {
return Err(format!("formula file not found: {}", p.display()));
}
Ok(())
} Try / catch
match publish(args) {
Err(e) if e.to_string().contains("formula file not found") => {
eprintln!("Check --formula path: {} (cwd: {:?})", args.formula.display(), std::env::current_dir());
std::process::exit(2);
}
Err(e) => return Err(e),
Ok(v) => Ok(v),
} Prevention
- Always pass an absolute path to --formula in CI scripts.
- Add a preflight `test -f "$FORMULA"` step before invoking dbt-ci homebrew publish.
- Verify the CI job checks out the repo containing the Formula/ directory.
When it happens
Trigger: Running `dbt-ci homebrew publish` with a `--formula` path that (a) does not exist on disk, (b) is a directory rather than a file, or (c) contains a typo/relative path resolved from the wrong working directory.
Common situations: Typo in the formula filename; running the command from a different directory than expected so a relative path doesn't resolve; CI checkout missing the `.rb` formula; passing a directory (e.g., a `Formula/` folder) instead of the specific file.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- formula filename does not end in .rb: {filename}
- --commit-author and --commit-email must be set together
- no `{prefix}{version}-*.tar.gz` tarballs found in {source_de
- --download-base-url requires at least one --target
- formula path has no filename: {}
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/a53b51427defa3c8.
Report an issue: GitHub.