← Back to issue list

yaml validation errors are not helpful if the file is empty

View original Github issue

Metadata

Project
charmcraft
Number
#2071
Type
issue
State
open
Author
PietroPasotti
Labels
Created
Updated
Closed

Current evaluation

charmcraft pack gives a generic 'Invalid file: metadata.yaml' error when the file is empty (comments only), making it hard to diagnose. A maintainer acknowledged it in June 2025 and left it open as low priority; the error is still generic in current code.

Suggested action: keep open

Reason: Maintainer @lengau explicitly triaged this on 2025-06-13 ('I'm going to leave this open if anyone else wants to do it'), so it is acknowledged and valid, not stale-closable. I confirmed in charmcraft/preprocess.py that the empty-file case still hits the generic 'Invalid file: metadata.yaml' CraftValidationError, so the problem remains applicable. The fix is a small UX improvement (special-case empty/None YAML load), but low priority per the maintainer.

Impact: 25 Quick Win: 21.25 Staleness: 70 Complexity: 15 Confidence: 85 Support Request: 10

Issue body

### Bug Description validation error is not helpful on an empty file. (it was actually hard to find out that the file was empty because I thought I'd deleted it). The project already had a (valid) charmcraft.yaml next to it, and couldn't figure out why charmcraft wasn't liking it. ### To Reproduce charmcraft pack ### Environment charmcraft 3.2.2 ### metadata.yaml ```yaml # Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. ``` ### Relevant log output ```shell ❯ charmcraft pack Invalid file: 'metadata.yaml' Recommended resolution: Ensure metadata.yaml meets the juju metadata.yaml specification. For more information, check out: https://juju.is/docs/sdk/metadata-yaml Full execution log: '/home/pietro/.local/state/charmcraft/log/charmcraft-20250110-134846.839621.log' ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 25
Quick Win: 21.25
Staleness: 70
Complexity: 15
Confidence: 85
Support Request: 10
keep open charmcraft pack gives a generic 'Invalid file: metadata.yaml' error when the file is empty (comments only), making it hard to diagnose. A maintainer acknowledged it in June 2025 and left it open as low priority; the error is still generic in current code.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 20
Confidence: 90
Support Request: 10
keep open Empty YAML files produce unhelpful validation errors in charmcraft. Reported as a bug, acknowledged by a maintainer, but currently unassigned and waiting for community contribution.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 20
Confidence: 85
Support Request: 10
keep open Unhelpful validation error when metadata.yaml is empty. Acknowledged by maintainers but marked low priority with no engineering time allocated.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 15
Confidence: 85
Support Request: 10
keep open Unhelpful validation error for empty YAML files. Maintainer acknowledged and left open as low priority.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 15
Confidence: 95
Support Request: 0
keep open charmcraft pack shows unhelpful validation errors for empty YAML files. The issue is open and available for community contribution, with no immediate engineering plans to fix it.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.