`no hooks nor dispatch file` after packing
Metadata
Current evaluation
Fixed by merged PR #2073 (commit a93a2d91): Charmcraft now rejects platform-based charm projects without parts instead of producing an invalid metadata-only charm.
Resolution: closed resolved
Reason: PR #2073 added explicit validation for projects with no parts, preventing successful packing of a charm that Juju would reject for lacking hooks or dispatch.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
Packing a charm leads to the artifact only having the `.yaml` files inside it, thus failing to deploy.
### To Reproduce
1) Download [application-charm on the tests of opensearch-operator](https://github.com/canonical/opensearch-operator/tree/2/edge/tests/integration/relations/opensearch_provider/application-charm).
2) Change `charmcraft.yaml` to be the following:
```yaml
base: ubuntu@22.04 # Also 24.04
platforms:
amd64: null
type: charm
```
3)
```
$ charmcraft pack
Packed application_amd64.charm
$ juju deploy ./application_amd64.charm
ERROR invalid charm "application": has no hooks nor dispatch file
```
4) Checking the files the issue is shown:
```
$ unzip ./application_amd64.charm
Archive: ../application_amd64.charm
inflating: actions.yaml
inflating: metadata.yaml
inflating: manifest.yaml
$ ll
total 12K
-rw-r--r-- 1 raul raul 676 dic 19 10:58 actions.yaml
-rw-r--r-- 1 raul raul 255 dic 19 10:58 manifest.yaml
-rw-r--r-- 1 raul raul 509 dic 19 10:58 metadata.yaml
```
### Environment
Ubuntu 22.04 LTS
```
charmcraft 3.2.2 5303 latest/stable canonical✓ classic
lxd 6.2-afb00d0 31571 latest/stable canonical✓ -
```
### charmcraft.yaml
```yaml
base: ubuntu@22.04 # Also 24.04
platforms:
amd64: null
type: charm
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #2073 (commit a93a2d91): Charmcraft now rejects platform-based charm projects without parts instead of producing an invalid metadata-only charm. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in #2073 (commit a93a2d91): Charmcraft now rejects platform charm projects without parts instead of producing an invalid charm containing only YAML metadata. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and tracked internally as CRAFT-3851. Charmcraft incorrectly succeeds when platforms lacks base, producing invalid charms. A workaround using explicit parts was provided, and required validation fixes were outlined. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Developer confirmed Charmcraft incorrectly succeeds without implicit parts when using platforms. Internal ticket CRAFT-3851 created to enforce validation. Workaround requires explicit parts configuration. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Maintainers identified that Charmcraft incorrectly succeeds when platforms lacks an implicit parts definition, producing invalid charms. An internal ticket CRAFT-3851 was created to enforce part validation and fail appropriately. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Issue closed without code fix. Workaround provided to explicitly define parts. Resolution tracked internally as CRAFT-3851 to enforce part validation and prevent implicit part creation. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
charmcraft#2073
(confidence 99%)
Merged commit a93a2d91 directly resolves the missing-parts behavior reported in #2055.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2073 fix(models/project): make no parts error explicit | charmcraft | merged | Merged PR #2073 (commit a93a2d91) rejects platform charm projects without parts, fixing the metadata-only charm packing failure in #2055. | |
| #821 5.5.0 changes pack semantics if the project file has different metadata | craft-application | open | Metadata-only charmcraft.yaml edits were skipped as "Already packed," leaving stale .charm artifacts; Charmcraft PR #2890 is reported to fix repacking after the edit. | |
| #2890 feat: skip repacking if project is not changed | charmcraft | merged | Merged PR implementing metadata mediation for config.yaml and actions.yaml so charmcraft skips repacking unchanged projects; fixes #2858 and canonical/craft-application#821. | |
| #334 Charmcraft cannot build a non-operator framework charm | charmcraft | closed | Generic hooks-only charm packing was fixed by PR #596, merged as 0dacae0a, allowing builds without an Operator Framework entry point; the fix shipped in edge. | |
| #2498 fix: `charmcraft pack --project-dir` with metadata.yaml | charmcraft | closed | Closed unmerged; superseded by #2644, which fixed metadata lookup for --project-dir and shipped in Charmcraft 4.2.1. | |
| #777 Do not modify the charm's project when packing using the reactive plugin (CRAFT-928). | charmcraft | merged | Merged PR #777 (CRAFT-928) via commit bac1d03b, preventing reactive packing from modifying the charm project and fixing #693's incorrect dirty versions. |