Symptom
A dbt job fails before any model runs, at the dbt deps step or at the first command after it. Typical messages:
Version error for package dbt-labs/dbt_utils: Could not find a satisfactory version from options: [...]This version of dbt is not supported with the '<package>' package(the package'srequire-dbt-versionexcludes your dbt version)Error checking out spec='...'orfatal: could not read Username for 'https://github.com'for a Git packageCompilation Error ... 'dbt_utils' is undefinedbecausedbt depswas never run, or it installed somewhere the project doesn't look- CI works but a laptop doesn't, or the other way round, because the two use different
package-lock.ymlfiles
These failures stop the whole project, so fix deps first and rerun the job.
Quick checks
dbt --version # dbt Core and adapter versions
cat packages.yml # or dependencies.yml
cat package-lock.yml # what is actually pinned
ls dbt_packages/ # what is actually installed
dbt deps # read the first error line carefully
| Symptom | Likely cause | Fix |
|---|---|---|
Could not find a satisfactory version | Two packages need incompatible versions of a shared dependency (often dbt_utils) | Widen your range, or upgrade the package with the stricter pin |
not supported with the '<package>' package | Package's require-dbt-version excludes your dbt version | Pin an older package release, or upgrade dbt |
| Git auth errors in CI only | No credential in the runner, or a token that expired | Use an env var token in the Git URL |
'dbt_utils' is undefined | deps not run, or wrong packages-install-path | Run dbt deps in the job, check dbt_project.yml |
| Package didn't upgrade after editing nothing | package-lock.yml still pins the old version | dbt deps --upgrade and commit the lock file |
| Different versions in CI and locally | Lock file not committed, or ignored | Commit package-lock.yml |
Fix 1: version conflicts
dbt resolves Hub packages and their dependencies against a single version range per package. A conflict means two packages want different, non-overlapping versions of the same thing.
# packages.yml
packages:
- package: dbt-labs/dbt_utils
version: [">=1.1.0", "<2.0.0"] # a range, not a single pin
- package: dbt-labs/codegen
version: [">=0.12.0", "<0.14.0"]
Steps:
- Read the error. It lists the versions dbt found for the conflicting package.
- Check each package's own
packages.ymlon the Hub or in its Git repository to see what it requires. - Change your own pins to ranges instead of exact versions, so that dbt can find an overlap.
- If there is still no overlap, upgrade the package that has the older requirement, or drop it.
To add or change a Hub package from the command line (dbt 1.7+):
dbt deps --add-package dbt-labs/dbt_utils@1.1.1
This edits packages.yml and installs the package. Check the change into Git like any other edit.
Tip
Pre-release Hub versions are ignored unless you set
install-prerelease: trueon that package. Use this only to test a fix you are waiting on, not in production.
Fix 2: require-dbt-version mismatches
Packages declare which dbt versions they support. After a dbt upgrade (or a downgrade in a pinned CI image), an older package may refuse to load.
dbt --version
# Compare with require-dbt-version in dbt_packages/<package>/dbt_project.yml
grep -A3 require-dbt-version dbt_packages/*/dbt_project.yml
Options, in order of preference:
- Upgrade the package to a release that supports your dbt version.
- Pin the dbt version in CI to match what the project was tested with (for example in
requirements.txt). - As a last resort, skip the
require-dbt-versioncheck with the--no-version-checkflag, then plan the upgrade.
dbt build --no-version-check # temporary, document why
Warning
--no-version-checkhides real incompatibilities. Macros can fail at run time or, worse, generate different SQL. Use it to get through an incident, not as a permanent setting.
Fix 3: private Git packages
Hub packages download over HTTPS from the dbt package hub. Git packages are cloned with the runner's git, using the runner's credentials.
packages:
- git: "https://{{ env_var('DBT_ENV_SECRET_GIT_CREDENTIAL') }}@github.com/acme/dbt-shared-macros.git"
revision: v2.3.0 # a tag or commit SHA, not a branch
subdirectory: dbt # only if the dbt project isn't at the repo root
Points that cause most failures:
- Env var name. Variables that start with
DBT_ENV_SECRET_are scrubbed from logs. Make sure the CI secret is exported under that exact name in the step that runsdbt deps. - Expired or under-scoped token. The token needs read access to that repository. Test it outside dbt with
git ls-remote https://<token>@github.com/acme/dbt-shared-macros.git. - Branch revisions.
revision: mainmakes builds non-repeatable and dbt warns about it. Use a tag or a commit SHA. - SSH URLs in CI.
git@github.com:...needs an SSH key andknown_hostson the runner. HTTPS with a token is usually easier in pipelines. - Network. Locked-down runners must reach the dbt Hub and your Git host. Check proxy settings (
HTTPS_PROXY) ifdepshangs and then times out.
For code in the same repository, use a local package instead of Git:
packages:
- local: ../shared_macros
Fix 4: package-lock.yml behaviour
Since dbt 1.7, dbt deps writes package-lock.yml with the exact resolved versions (and a hash of the package config). Later runs install what the lock file says, not the newest version that matches your range.
| You want to | Run |
|---|---|
| Install exactly what's locked | dbt deps |
Pick up a change you made to packages.yml | dbt deps (it detects the changed config and re-resolves) |
| Upgrade everything within your ranges | dbt deps --upgrade |
| Update the lock file without installing | dbt deps --lock |
dbt deps --upgrade
git diff package-lock.yml # review what moved
git add packages.yml package-lock.yml
git commit -m "Upgrade dbt packages"
Caution
If
package-lock.ymlis in.gitignore, or every CI run deletes it, each build resolves versions again. A new package release can then change the generated SQL in production without a code change. Commit the lock file and upgrade on purpose.
Fix 5: packages installed but not found
# dbt_project.yml
packages-install-path: dbt_packages # default; older projects used dbt_modules
clean-targets: ["target", "dbt_packages"]
- Each fresh CI container has no packages. Run
dbt depsin the same job, beforedbt build, unless you cachedbt_packages/on purpose. - In dbt 1.6 and later you can declare packages in
dependencies.ymlinstead ofpackages.yml, but not in both. Pick one file. - If you suspect stale files, run
dbt cleanfollowed bydbt deps.
Prevent it next time
- Use version ranges for Hub packages and commit
package-lock.yml. Upgrade withdbt deps --upgradein a pull request, never by accident. - Pin dbt Core and the adapter in
requirements.txtor your container image so thatrequire-dbt-versionchecks are predictable. - Pin Git packages to tags or SHAs, and store the token as a
DBT_ENV_SECRET_variable with an owner and an expiry reminder. - Add a CI step that runs
dbt depsfollowed bydbt parse. Package problems then fail in seconds on the pull request, not at 02:00 in the production job. - Review package changelogs before upgrading
dbt_utilsor other macro packages your models depend on.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get