← Back to issue list

Provide more meaningful output when rockcraft.yaml is invalid

View original Github issue

Metadata

Project
rockcraft
Number
#182
Type
issue
State
open
Author
arturo-seijas
Labels
Created
Updated
Closed

Current evaluation

Rockcraft pack on an invalid rockcraft.yaml prints a raw pyyaml ScannerError traceback instead of a friendly message with the offending line. The underlying craft-application library now wraps YAML errors in a YamlError with problem text and mark details, so the original complaint is likely already addressed.

Suggested action: keep open

Reason: The issue is old (last activity 1301 days ago, no labels, only a clarifying exchange between reporter and maintainer) but the fix appears to have landed in the shared craft-application dependency: commit df906c31 'fix(yaml): wrap error message for YAML errors (#427)' introduced YamlError.from_yaml_error, and safe_yaml_load in craft_application/util/yaml.py now raises YamlError with the problem text and full mark (line/column) instead of leaking a raw ScannerError. Rockcraft's ProjectService inherits this path, so the behavior is likely fixed, but no maintainer has confirmed or closed the issue, so it should be verified against a current rockcraft release before closing.

Impact: 40 Quick Win: 30.0 Staleness: 70 Complexity: 25 Confidence: 75 Support Request: 10

Issue body

Hi! I've been trying to run `rockcraft pack` with a valid yaml wrongly indented: ``` name: Indico summary: Indico rocks description: Indico OCI images for the Indico charm version: "1.0" base: bare build-base: ubuntu:22.04 license: Apache-2.0 platforms: amd64: parts: indico: source: plugins plugin: python python-packages: - indico==3.2.0 ``` and I'm getting the following output: ``` Logging execution to '/home/arturo/.local/state/rockcraft/log/rockcraft-20230206-173725.594029.log' rockcraft internal error: ScannerError(None, None, 'mapping values are not allowed here', <yaml.error.Mark object at 0x7fddfe017610>) Full execution log: '/home/arturo/.local/state/rockcraft/log/rockcraft-20230206-173725.594029.log' ``` I would have expected the output to show the affected line or element. Thank you

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 30.0
Staleness: 70
Complexity: 25
Confidence: 75
Support Request: 10
keep open Rockcraft pack on an invalid rockcraft.yaml prints a raw pyyaml ScannerError traceback instead of a friendly message with the offending line. The underlying craft-application library now wraps YAML errors in a YamlError with problem text and mark details, so the original complaint is likely already addressed.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 20
Confidence: 80
Support Request: 10
close stale Request for improved YAML parsing error messages in rockcraft to show affected lines. Unlabelled, no maintainer response, inactive for over 3 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 25
Confidence: 80
Support Request: 10
needs triage Feature request to improve YAML parsing error messages in rockcraft, providing line numbers and context instead of raw Python scanner errors. Unlabeled and inactive for over 3 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 5
close stale Improve error messages for invalid rockcraft.yaml files to display the specific line or element causing YAML parsing failures instead of generic internal errors. Currently open and awaiting triage or assignment.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-application#427 (confidence 70%)

    craft-application PR #427 (commit df906c31) added YamlError wrapping for YAML parse errors with problem and mark details; rockcraft's project loading goes through craft_application's safe_yaml_load, so the raw ScannerError output reported here should now be a friendly message with line info.

Related issues

No related issues found above the similarity threshold.