Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] packages.yml missing version gives an error #10048

Open
2 tasks done
dbeatty10 opened this issue Apr 25, 2024 · 0 comments · May be fixed by #10049
Open
2 tasks done

[Bug] packages.yml missing version gives an error #10048

dbeatty10 opened this issue Apr 25, 2024 · 0 comments · May be fixed by #10049
Labels
bug Something isn't working

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Apr 25, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

See logs below for current behavior which includes an ugly stack trace.

Expected Behavior

$ dbt deps
23:31:36  Running with dbt=1.8.0-b3
23:31:36  Encountered an error:
Runtime Error
  The packages.yml file in this project is malformed. Please double check
  the contents of this file and fix any errors before retrying.
  
  You can find more information on the syntax for this file here:
  https://docs.getdbt.com/docs/package-management
  
  Validator Error:
  dbt-labs/dbt_utils is missing the version. When installing from the Hub package index, version is a required property
  

Error encountered in dbt_project.yml

Steps To Reproduce

packages.yml

packages:
  - package: dbt-labs/dbt_utils
dbt deps

Relevant log output

$ dbt deps     
23:31:09  Running with dbt=1.8.0-b3
23:31:09  Encountered an error:
'version'
23:31:09  Traceback (most recent call last):
  File "dbt-core/core/dbt/cli/requires.py", line 106, in wrapper
    result, success = func(*args, **kwargs)
  File "dbt-core/core/dbt/cli/requires.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "dbt-core/core/dbt/cli/requires.py", line 167, in wrapper
    return func(*args, **kwargs)
  File "dbt-core/core/dbt/cli/requires.py", line 200, in wrapper
    project = load_project(
  File "dbt-core/core/dbt/config/runtime.py", line 51, in load_project
    project = Project.from_project_root(
  File "dbt-core/core/dbt/config/project.py", line 764, in from_project_root
    return partial.render(renderer)
  File "dbt-core/core/dbt/config/project.py", line 333, in render
    return self.create_project(rendered)
  File "dbt-core/core/dbt/config/project.py", line 480, in create_project
    packages: PackageConfig = package_config_from_data(
  File "dbt-core/core/dbt/config/project.py", line 148, in package_config_from_data
    PackageConfig.validate(packages_data)
  File "dbt-core/core/dbt/contracts/project.py", line 119, in validate
    if not package["version"]:
KeyError: 'version'

Environment

- OS: 
- Python: 
- dbt:

Which database adapter are you using with dbt?

No response

Additional Context

Easy fix here:

if not package["version"]:

Make this change:

-                if not package["version"]:
+                if not package.get("version"):
@dbeatty10 dbeatty10 added bug Something isn't working triage and removed triage labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant