Multiple `charmcraft pack` fail on mismatching platforms
Metadata
Current evaluation
Consecutive charmcraft pack commands fail when charms define different platforms due to retained build state, and the open issue awaits triage and assignment.
Suggested action: needs triage
Reason: The issue is well-structured and actionable but lacks labels, maintainer comments, and an assignee. It requires initial triage to categorize, prioritize, and assign before technical review can begin.
Staleness:
25
Complexity:
40
Confidence:
90
Support Request:
0
Issue body
### Check existing issues
- [x] I've verified that this bug isn't described by any existing issues.
### Bug description
With Charmcraft 4.0.1, the [charm-lxd](https://github.com/canonical/charm-lxd) CI was building the primary LXD charm for 24.04 and 22.04 followed by an ancillary charm for 24.04 only one:
```
charmcraft pack -v
echo "==> ancillary charm for testing purposes"
charmcraft pack -v --project-dir examples/https-client
```
Now with Charmcraft 4.2.0, packing the ancillary charm fails with:
```
Staging charm
Priming charm
Packing...
Packing charm https-client_ubuntu-24.04-amd64.charm
Packed https-client_ubuntu-24.04-amd64.charm
Launching managed ubuntu 22.04 instance...
Creating instance from base instance
Starting instance
Starting charmcraft, version 4.2.0
Logging execution to '/tmp/charmcraft.log'
Platform 'ubuntu-22.04-amd64' not found in the project definition.
Detailed information: Valid platforms are: 'ubuntu-24.04-amd64', 'ubuntu-24.04-arm64', 'ubuntu-24.04-armhf', 'ubuntu-24.04-ppc64el', 'ubuntu-24.04-riscv64', 'ubuntu-24.04-s390x'.
Failed to run charmcraft in instance
```
The full logs: https://github.com/canonical/charm-lxd/actions/runs/23904129367/job/69708427467
The [main `charmcraft.yaml`](https://github.com/canonical/charm-lxd/blob/b7b57f9660d77c242afc348a26b49b7bed6dcc0e/charmcraft.yaml) and the [anciliary `charmcraft.yaml`](https://github.com/canonical/charm-lxd/blob/b7b57f9660d77c242afc348a26b49b7bed6dcc0e/examples/https-client/charmcraft.yaml)
### Steps to reproduce
Build 2 charms consecutively. The first with:
```
type: charm
platforms:
ubuntu-24.04-amd64:
build-on: [ubuntu@24.04:amd64]
build-for: [ubuntu@24.04:amd64]
ubuntu-22.04-arm64:
build-on: [ubuntu@22.04:amd64]
build-for: [ubuntu@22.04:amd64]
```
And the second with:
```
type: charm
platforms:
ubuntu-24.04-amd64:
build-on: [ubuntu@24.04:amd64]
build-for: [ubuntu@24.04:amd64]
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| 2026-06-15 12:07:00.343859+00:00 | qwen3.6-35b-a3b-mtp-q6 |
Staleness:
25
Complexity:
40
Confidence:
90
Support Request:
0
|
needs triage | Consecutive charmcraft pack commands fail when charms define different platforms due to retained build state, and the open issue awaits triage and assignment. |
| 2026-06-15 12:05:06.972181+00:00 | pending | — | — | — |