canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.
https://snapcraft.io
GNU General Public License v3.0
1.19k stars 447 forks source link

`snapcraft internal error: AttributeError("'NoneType' object has no attribute 'get'")` on empty app #5112

Open Saviq opened 1 month ago

Saviq commented 1 month ago

Bug Description

Snapcraft fails with an internal error when any of apps.* are None

To Reproduce

snapcraft --verbose

Environment

N/A

snapcraft.yaml

# ... usual snap details
apps:
  foo:
  bar:

Relevant log output

Starting snapcraft, version 8.4.3
Log verbosity level set to BRIEF
Preparing application...
Configuring application...
Setting up ConfigService
Build plan: platform=None, build_for=None
Loading project file '/home/michal/dev/canonical/mesa-2404/snap/snapcraft.yaml'
snapcraft internal error: AttributeError("'NoneType' object has no attribute 'get'")
Traceback (most recent call last):
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/craft_application/application.py", line 568, in run
    return_code = self._run_inner()
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/snapcraft/application.py", line 215, in _run_inner
    return_code = super()._run_inner()
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/craft_application/application.py", line 539, in _run_inner
    self.services.project = self.get_project(
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/craft_application/application.py", line 315, in get_project
    yaml_data = self._transform_project_yaml(yaml_data, build_on, build_for)
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/craft_application/application.py", line 630, in _transform_project_yaml
    yaml_data = self._extra_yaml_transform(
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/snapcraft/application.py", line 262, in _extra_yaml_transform
    new_yaml_data = apply_extensions(yaml_data, arch=arch, target_arch=target_arch)
  File "/snap/snapcraft/12823/lib/python3.10/site-packages/snapcraft/extensions/_utils.py", line 48, in apply_extensions
    extension_names = app_definition.get("extensions", [])
AttributeError: 'NoneType' object has no attribute 'get'
Full execution log: '/home/michal/.local/state/snapcraft/log/snapcraft-20241012-132238.968481.log'

Additional context

No response

syncronize-issues-to-jira[bot] commented 1 month ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3573.

This message was autogenerated

lengau commented 1 month ago

Just a note to whoever fixes this that this error occurs when applying extensions:

  File "/snap/snapcraft/12823/lib/python3.10/site-packages/snapcraft/extensions/_utils.py", line 48, in apply_extensions
    extension_names = app_definition.get("extensions", [])