Check existing issues
Bug description
When a project has name in charmcraft.yaml and a separate metadata.yaml (without name), the packed .charm file contains a metadata.yaml with no name field. This makes the charm undeployable — Juju rejects it with "metadata: name: expected string, got nothing".
Steps to reproduce
- Create a project with
name: my-charm in charmcraft.yaml and a separate metadata.yaml that has summary, description, and relations but no name field.
- Run
charmcraft pack --destructive-mode.
- Unzip the resulting
.charm and inspect metadata.yaml — name is absent.
- Attempt to deploy locally:
juju deploy ./my-charm_*.charm → fails with "metadata: name: expected string, got nothing".
Environment
charmcraft 4.0.1 (snap), destructive mode, Ubuntu 24.04 amd64.
charmcraft.yaml
name: example-charm
type: charm
platforms:
ubuntu@24.04:amd64:
parts:
charm: {}
With a separate `metadata.yaml` containing `summary`, `description`, and relations but no `name`.
Log output
juju.errors.JujuError: {"error":"cannot upload charm: invalid charm archive: metadata: name: expected string, got nothing","error-code":"bad request"}
Check existing issues
Bug description
When a project has
nameincharmcraft.yamland a separatemetadata.yaml(withoutname), the packed.charmfile contains ametadata.yamlwith nonamefield. This makes the charm undeployable — Juju rejects it with"metadata: name: expected string, got nothing".Steps to reproduce
name: my-charmincharmcraft.yamland a separatemetadata.yamlthat hassummary,description, and relations but nonamefield.charmcraft pack --destructive-mode..charmand inspectmetadata.yaml—nameis absent.juju deploy ./my-charm_*.charm→ fails with"metadata: name: expected string, got nothing".Environment
charmcraft 4.0.1 (snap), destructive mode, Ubuntu 24.04 amd64.
charmcraft.yaml
Log output
juju.errors.JujuError: {"error":"cannot upload charm: invalid charm archive: metadata: name: expected string, got nothing","error-code":"bad request"}