Skip to content

Fix package version validation to handle missing property#12650

Open
benlevycmp wants to merge 4 commits intodbt-labs:mainfrom
benlevycmp:patch-1
Open

Fix package version validation to handle missing property#12650
benlevycmp wants to merge 4 commits intodbt-labs:mainfrom
benlevycmp:patch-1

Conversation

@benlevycmp
Copy link

Resolves #12649

Problem

Previously, the custom error would not be raised if the version property was missing entirely, rather than simply falsy, and only a cryptic KeyError would be raised.

Solution

Replaces direct key access with the safer get() method.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

Previously, the custom error would be skipped if the `version` property was missing entirely, rather than simply falsy, and only a cryptic `KeyError` would be raised
@benlevycmp benlevycmp requested a review from a team as a code owner March 12, 2026 23:27
@cla-bot cla-bot bot added the cla:yes label Mar 12, 2026
@github-actions
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@dbeatty10
Copy link
Contributor

Thanks for opening this @benlevycmp !

Please do the following so we can review:

  1. Add a changelog entry
  2. Add a unit test or functional test where version is omitted for a hub package (examples here, here, here, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:yes community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Missing version specification in packages.yml leads to cryptic KeyError when using dbt debug

2 participants