← Back to issue list

Multiple `charmcraft pack` fail on mismatching platforms

View original Github issue

Metadata

Project
charmcraft
Number
#2631
Type
issue
State
open
Author
simondeziel
Labels
—
Created
Updated
Closed
—

Current evaluation

Consecutive charmcraft pack runs with different platform sets fail: second charm (24.04 only) launches a 22.04 instance and errors 'Platform not found'. Regression from 4.0.1, still present in 4.3.1, no maintainer response.

Suggested action: needs triage

Reason: The issue has no labels, assignee, or maintainer response, so it has not been triaged. It is well-scoped with a clear reproducer and logs, and the error trace points to craft-application's project service raising InvalidPlatformError when CRAFT_PLATFORM doesn't match the project, but the exact root cause (likely the host build plan including a platform from the previous project) is unconfirmed.

Evaluated by: mr-cal-bot

Impact: 60 Quick Win: 19 Complexity: 55 Confidence: 55 Actionability: 70

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
~deepseek/deepseek-pro-latest
Impact: 60
Quick Win: 19
Complexity: 55
Confidence: 55
Actionability: 70
needs triage Consecutive charmcraft pack runs with different platform sets fail: second charm (24.04 only) launches a 22.04 instance and errors 'Platform not found'. Regression from 4.0.1, still present in 4.3.1, no maintainer response.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 22
Complexity: 60
Confidence: 80
Actionability: 80
keep open Regression in Charmcraft 4.2.0+ where building multiple charms in sequence causes the second charm to fail with InvalidPlatformError when the first charm has platforms the second doesn't.
qwen/qwen3.8-27b
Impact: 65
Quick Win: 26
Staleness: 15
Complexity: 60
Confidence: 70
Support Request: 5
needs triage Charmcraft 4.2.0+ reuses a managed LXD instance from a prior `charmcraft pack` of a different project, causing the second pack to fail with 'Platform not found in the project definition' when platform sets differ. Still reproducible on 4.3.1 per reporter's 2026-08-17 comment; no maintainer response or labels yet.
qwen/qwen3.6-35b-a3b
Staleness: 25
Complexity: 45
Confidence: 90
Support Request: 10
needs triage Regression in Charmcraft 4.2.0+ where packing an ancillary charm fails with a platform mismatch error when run after a primary charm with different platforms. Currently unlabelled and awaiting maintainer review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 40
Confidence: 85
Support Request: 10
needs triage Regression in Charmcraft 4.2.0 where packing a secondary charm fails with a platform mismatch error when run after a primary charm. Untriaged, no maintainer response after 110 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 50
Confidence: 90
Support Request: 10
needs triage Regression in Charmcraft 4.2.0 where consecutive charmcraft pack commands fail due to platform state leakage. Ancillary charm incorrectly expects a platform from the previously built charm. Untriaged, no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 55
Complexity: 60
Confidence: 85
Support Request: 10
needs triage charmcraft pack fails when building multiple charms consecutively with mismatching platforms, incorrectly reusing a managed instance from a previous build. Untriaged, no maintainer response.

Update history

Date Change
updated

Related issues

Issue Project State Summary Similarity
#2686 `charmcraft pack` Internal error on a 26.04 host charmcraft closed Fixed in the latest edge build; commit eeca3f79 (PR #2764) updated craft-providers to >=3.7.1 for newer Ubuntu base support.
71%
#2816 `charmcraft pack` fails on Resolute charmcraft open charmcraft pack fails on Ubuntu Resolute 26.04 hosts when using a Jammy 20.04 build base: snapd inside the LXD build instance cannot reload snap-confine AppArmor profiles; no maintainer response yet.
70%
#2078 `charmcraft clean` does not clean all platforms for charm charmcraft open Open, reproducible cleanup bug: charmcraft clean uses current project platforms to derive build instances, leaving containers for removed platforms; no resolving fix is linked.
70%