Skip to content

name field missing from packed charm's metadata.yaml when defined in charmcraft.yaml alongside a separate metadata.yaml #2680

Description

@javierdelapuente

Check existing issues

  • I've verified that this bug isn't described by any 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

  1. 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.
  2. Run charmcraft pack --destructive-mode.
  3. Unzip the resulting .charm and inspect metadata.yamlname is absent.
  4. 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"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions