← Back to issue list

lxd: better surfacing of errors

View original Github issue

Metadata

Project
snapcraft
Number
#1647
Type
pull request
State
merged
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

Merged in snapcraft#1647 as commit 71f48bdc9, improving LXD error handling so callers return silent, correctly coded errors without printing messages twice.

Resolution: closed resolved

Reason: PR snapcraft#1647 was approved and merged as commit 71f48bdc9. It made callers emit silent errors with the appropriate exit code while callees display the underlying LXD error.

Evaluated by: mr-cal-bot

No scores available.

Issue body

We do not want to print the same error twice, so the caller should produce a silent error with a proper exit code as the message related to the error would be displayed by the callee. Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [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] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- I do wish ContainerRunError would be more generalized and that these Container* exceptions live inside the lxd package, but oh well, this fixes the problem today.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1647 as commit 71f48bdc9, improving LXD error handling so callers return silent, correctly coded errors without printing messages twice.
stealth/space-bunny-alpha — closed resolved Merged #1647 (71f48bdc9) to prevent duplicate LXD error output: callers now return silent errors with exit codes, leaving messages to callees.
qwen/qwen3.6-35b-a3b — — Merged. Resolves duplicate error printing in LXD by having callers return silent errors with proper exit codes, allowing callees to handle message display. Approved and merged after CI validation.
qwen3.6-35b-a3b-mtp-q6 — — Merged to prevent duplicate error output in LXD operations. Callers now return silent errors with proper exit codes, allowing callees to handle message display. CI passed with noted integration test flakes.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#161 lxd: improve error messages craft-providers merged Merged PR #161 consolidated duplicate LXD error messages and added help text to other errors in commit 18d4470.
78%
#1689695 Make the error message when LXC is not found a bit better snapcraft (launchpad) closed Fixed by merged PR canonical/snapcraft#1400 (commit 2a5affc17), adding distinct handling when the lxc executable is unavailable.
75%
#1930 lxd: friendly errror with suggestions if network is broken snapcraft merged Merged in snapcraft#1930 (cdbac658d), replacing raw LXD network-probe failures with friendly errors that include the checked URL and guidance.
75%
#2095 lxd: proper error classes for container errors snapcraft merged Merged as caf555acb, introducing dedicated LXD error classes, improving architecture lookup error handling, and adding unit tests.
74%
#1641 lxd: catch CalledProcessError in _container_run snapcraft closed Superseded by #1647, merged as 71f48bdc9, which improved LXD error handling and propagated exit codes without duplicating nested Snapcraft errors.
73%
#4933 bug: snapcraft prints insufficient logging when using lxd snapcraft closed Closed as a duplicate of #4499, which was fixed by merged PR #5188 (commit a9fc44093) to surface snapd's snap pack stderr after snapd 2.66 added support.
73%
#1703344 snapcraft cleanbuild exits with a traceback when lxd is not installed snapcraft (launchpad) closed Fixed cleanbuild’s traceback when LXD is absent by handling the missing lxc executable and reporting a clear error. Merged in snapcraft#1400.
72%
#2936 build providers: clean up LXD startup message snapcraft merged Merged PR snapcraft#2936 (commit bc605d706) trimmed the misleading LXD cloud-init startup log message, removing an implementation detail that users misread as data being sent to the cloud.
72%
#29 lxd: introduce errors module and LXDError craft-providers merged PR #29 merged into main (merge commit ceafb67, commit 509204c 'lxd: introduce errors module and LXDError'), adding craft_providers/lxd/errors.py with LXDError plus LXDInstallationError and LXDUnstableImageError.
72%
#3112 spread: remove dead code for lxd setup and add debug prints snapcraft merged Merged PR #3112 in commit cf2fec383, removing unreachable LXD setup code and adding debug output for intermittent LXD snap-install failures.
71%