snap config: do not crash when config cannot be retrieved
Metadata
Current evaluation
Merged. Fixed a crash in get_snap_config() when snapd is unavailable by catching and logging errors. Approved by reviewer and passed CI checks.
Suggested action: —
No scores available.
Issue body
- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [X] Have you successfully run `make lint`?
- [X] Have you successfully run `pytest tests/unit`?
-----
Make the `get_snap_config()` function more robust.
In docker containers, snapcraft appears to be installed as a snap, but `snapd` is not available and it causes `snaphelpers` to raise an error when fetching the snap config. Now, those errors are caught and logged without crashing.
https://github.com/snapcore/snapcraft/pull/3903 broke snapcraft in docker, which was reported [here](https://forum.snapcraft.io/t/snapcraft-7-2-depends-on-snapd-socket-at-runtime/32382) and [here](https://forum.snapcraft.io/t/call-for-testing-snapcraft-7-2-0/32171/16).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Fixed a crash in get_snap_config() when snapd is unavailable by catching and logging errors. Approved by reviewer and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Updates get_snap_config() to catch snaphelpers errors when snapd is unavailable, preventing crashes in Docker environments. Resolves a regression from PR #3903 by logging failures instead of crashing, avoiding internal name access. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Resolves a Docker crash by catching snaphelpers errors when snapd is unavailable during config retrieval. Submodule test failures were fixed and exception handling was adjusted per review before merging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3974 snap config: catch more errors when config cannot be retrieved | snapcraft | merged | Merged improvements to snap configuration error handling. Follows up on PR #3971 to catch additional retrieval failures reported by users. Approved by one reviewer, passed CI checks, and updated four files (+30/-10). | |
| #1598 recording: do not crash when snapd is not installed | snapcraft | merged | Merged a fix preventing a crash when snapd is not installed. The maintainer approved the changes, noting that remaining CI failures were handled in a separate pull request. | |
| #1325 cli: proper error for failed snap command | snapcraft | merged | Merged: returns a proper error code when a snap command fails. Approved by one reviewer with no unresolved comments. Changes span two files (+15/-2). | |
| #5512 fix: don't crash if "snap" is a file | snapcraft | merged | Merged fix preventing crashes when the snap directory is replaced by a file. The change raises a ProjectDirectoryTypeError with improved error messaging, resolving issue #5167. Approved by two reviewers and passed CI checks. | |
| #497 fix(config): warn on snapctl errors | craft-application | merged | Merged a configuration fix that warns on snapctl errors. Approved by two reviewers, the change adds 32 lines across two files and addresses pending review feedback. | |
| #1815 repo: handle invalid snaps | snapcraft | merged | Merged changes handling invalid snaps in build-snaps with a clear error message. Adds retries to information fetching for improved network failure debugging. Approved after resolving a minor CI typo. | |
| #499 fix(config): wrap snap config handler in snap check | craft-application | merged | Merged a fix wrapping the snap config handler in a snap environment check to prevent execution errors outside snaps. Approved by two reviewers, passed CI, and introduced 12 lines across two files. |