← Back to issue list

CraftError messages with new lines render inconsistently

View original Github issue

Metadata

Project
craft-cli
Number
#269
Type
issue
State
open
Author
mr-cal
Labels
—
Created
Updated
Closed
—

Current evaluation

CraftError messages with embedded newlines added terminal padding before the resolution line; #270 fixed this in 0ca6940, shipped in 2.7.0.

Suggested action: close resolved

Reason: PR #270 was merged as commit 0ca6940 to correctly print multi-line errors, and the 2.7.0 changelog explicitly records the fix. Current report_error code splits the CraftError message with splitlines() and prints each line individually, preventing the reported padding artifact.

Evaluated by: mr-cal-bot

Impact: 32 Quick Win: 22 Complexity: 24 Confidence: 98 Actionability: 91

Issue body

### Bug Description If the `message` field in a `CraftError` contains a new line, craft-cli appears to append whitespace, which causes the appearance of a new line between the `message` and `resolution` sections. Note that I cannot use the `details` field because `details` isn't visible at the default `brief` verbosity level. ### To Reproduce ```diff diff --git a/examples.py b/examples.py index c842a1a..c7fe76e 100755 --- a/examples.py +++ b/examples.py def example_10(): @@ -513,6 +516,15 @@ def example_30(): time.sleep(0.001) +def example_31(): + """Show an error.""" + path = "/dev/null" + raise CraftError( + message="Remote build does not support building multiple snaps on the same architecture:\n - Building on 'amd64' will create snaps for 'amd64' and 'riscv64'.", + resolution="this is the resolution", + ) + + # -- end of test cases if len(sys.argv) < 2: ``` ### part yaml _No response_ ### Relevant log output See the attached pictures. The same photo is highlighted to show what appears to be extraneous whitespace. ![Screenshot_20240827_164350](https://github.com/user-attachments/assets/0d4690da-28b6-48c5-91d0-fd642bde3a7b) ![Screenshot_20240827_164359](https://github.com/user-attachments/assets/902c95ea-caf6-442f-a487-d5aea5497eaf)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 32
Quick Win: 22
Complexity: 24
Confidence: 98
Actionability: 91
close resolved CraftError messages with embedded newlines added terminal padding before the resolution line; #270 fixed this in 0ca6940, shipped in 2.7.0.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 24
Complexity: 10
Confidence: 95
Actionability: 90
close resolved CraftError messages with newlines rendered with extra whitespace between message and resolution. Fixed by PR #210 which removes trailing spaces.
qwen/qwen3.8-27b
Impact: 30
Quick Win: 22
Staleness: 55
Complexity: 25
Confidence: 70
Support Request: 5
keep open CraftError messages containing new lines render with extraneous whitespace between the message and resolution sections. A maintainer commented that PR #210 (remove trailing spaces) likely fixes this indirectly.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 20
Confidence: 85
Support Request: 0
keep open Bug report about CraftError messages with new lines rendering inconsistently due to whitespace appending. Issue is 693 days old, last activity 498 days ago. A maintainer acknowledged it and linked a potential fix in PR #210.
qwen3.6-35b-a3b-mtp-q6
Staleness: 92
Complexity: 20
Confidence: 85
Support Request: 5
close stale Bug report about inconsistent rendering of CraftError messages containing newlines, causing extra whitespace between message and resolution sections. Inactive for over a year; a maintainer suggested a related PR may have fixed it.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: craft-cli#270 (confidence 99%)

    Merged as 0ca6940 to print multi-line error messages correctly and released in 2.7.0.

  • Likely Fixed By: craft-cli#210 (confidence 87%)

    A maintainer explicitly said this PR indirectly fixed the problem by no longer filling terminal lines with spaces.

Related issues

No related issues found above the similarity threshold.