← Back to issue list

Provide a better error message when loading a multi-document yaml

View original Github issue

Metadata

Project
craft-application
Number
#485
Type
issue
State
open
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Request to improve the error message when loading multi-document YAML files, currently showing a raw ComposerError instead of a clear 'not supported' message. Untriaged, no labels, no maintainer response since the Jira bot comment.

Suggested action: needs triage

Reason: The issue has no labels, no maintainer acknowledgement, and only a Jira sync bot comment. The current code in craft_application/util/yaml.py wraps yaml.YAMLError into YamlError via from_yaml_error, but does not special-case multi-document YAML (ComposerError) to produce a user-friendly 'multi-document YAML not supported' message. The fix is straightforward: detect ComposerError or multi-document streams in safe_yaml_load and raise a YamlError with a clear resolution message.

Impact: 30 Quick Win: 25.5 Staleness: 55 Complexity: 15 Confidence: 72 Support Request: 0

Issue body

### What needs to get done Right now the workflow when reading a multi-document yaml file returns an internal error: ``` $ charmcraft pack charmcraft internal error: ComposerError('expected a single document in the stream', <yaml.error.Mark object at 0x73a1c3d77970>, 'but found another document', <yaml.error.Mark object at 0x73a1c3ce0340>) Full execution log: '/home/lengau/.local/state/charmcraft/log/charmcraft-20240920-152105.956862.log' ``` This should be converted to an error message that we don't support multi-document YAML files. ### Why it needs to get done Strange ux. See: https://github.com/canonical/charmcraft/issues/214

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 30
Quick Win: 25.5
Staleness: 55
Complexity: 15
Confidence: 72
Support Request: 0
needs triage Request to improve the error message when loading multi-document YAML files, currently showing a raw ComposerError instead of a clear 'not supported' message. Untriaged, no labels, no maintainer response since the Jira bot comment.
qwen/qwen3.6-35b-a3b
Staleness: 90
Complexity: 10
Confidence: 85
Support Request: 10
needs triage Unlabelled request to replace an internal ComposerError with a clear message stating multi-document YAML is unsupported. Currently inactive for over a year with only automated comments, awaiting maintainer assessment.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 85
Support Request: 20
needs triage Request to replace an internal ComposerError with a clear user-facing message indicating multi-document YAML files are unsupported. Currently untriaged and inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 10
Confidence: 75
Support Request: 5
needs triage Replace cryptic ComposerError with a clear message stating multi-document YAML files are unsupported. Open and awaiting implementation with minimal recent activity.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.