← Back to issue list

`charmcraft pack -o` fails: `FileNotFoundError`

View original Github issue

Metadata

Project
charmcraft
Number
#1930
Type
issue
State
closed
Author
barrettj12
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by merged PR #2600 (commit 868da353): pack -p and -o paths are now applied outside the build container, preventing FileNotFoundError with custom output directories.

Resolution: closed resolved

Reason: The issue was resolved by merged PR #2600, commit 868da353, which moved project and output path handling outside the build container. This prevents the FileNotFoundError raised by charmcraft pack -o.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description `charmcraft pack` does not seem to work when provided with the `-o` option to control the output directory. It fails with the following cryptic message: `charmcraft internal error: FileNotFoundError(2, 'No such file or directory')`. ### To Reproduce 1. Checkout https://github.com/juju/juju 2. Run `charmcraft pack -p ./testcharms/charms/lxd-profile -o ./testcharms/charms` ### Environment OS: Ubuntu 22.04.5 LTS Charmcraft 3.2.1 installed from snap ### charmcraft.yaml ```yaml type: "charm" bases: - build-on: - name: "ubuntu" channel: "20.04" architectures: ["amd64", "arm64"] run-on: - name: "ubuntu" channel: "22.04" architectures: - amd64 - arm64 - s390x - name: "ubuntu" channel: "20.04" architectures: - amd64 - arm64 - s390x - name: "ubuntu" channel: "18.04" architectures: - amd64 - arm64 - s390x - name: "ubuntu" channel: "16.04" architectures: - amd64 - arm64 - s390x parts: tiny-bash: plugin: dump source: . prime: - README - config.yaml - hooks - icon.svg - lxd-profile.yaml - metadata.yaml ``` ### Relevant log output ```shell $ charmcraft pack -p ./testcharms/charms/lxd-profile -o ./testcharms/charms WARNING: Charmcraft does not validate that charms with multiple given architectures are architecture agnostic. charmcraft internal error: FileNotFoundError(2, 'No such file or directory') Failed to execute charmcraft in instance. Full execution log: '/home/jordan/.local/state/charmcraft/log/charmcraft-20240930-095541.119122.log' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #2600 (commit 868da353): pack -p and -o paths are now applied outside the build container, preventing FileNotFoundError with custom output directories.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #2600 (commit 868da353): pack -p and -o paths are now applied outside the build container, so custom output directories no longer raise FileNotFoundError.
qwen3.6-35b-a3b-mtp-q6 — — A FileNotFoundError with charmcraft pack -o was abandoned and closed without resolution. No fix was implemented, and a recent comment confirms the bug persists.
qwen/qwen3.6-35b-a3b — — Closed without resolution. A recent comment confirms the bug persists, indicating the issue was likely marked stale or abandoned. The -o flag continues to trigger a FileNotFoundError during charm packing.
qwen/qwen3.6-35b-a3b — — Closed without resolution. No fix or workaround was provided, and the issue persists as confirmed by a recent user reporting the same FileNotFoundError when using the -o flag with charmcraft pack.
qwen3.6-35b-a3b-mtp-q6 — — Closed without a fix or resolution. A recent comment confirms the FileNotFoundError when using the -o flag remains unresolved, indicating the bug was abandoned.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#2600 (confidence 100%)

    Merged PR reported as the direct fix for issue #1930, implemented in commit 868da353.

Related issues

Issue Project State Summary Similarity
#2600 fix: make the -p and -o arguments work correctly charmcraft merged Merged PR #2600 (commit 868da353), fixing charmcraft pack to honor --project-dir and apply --output outside the container; this closes #1930.
77%
#514 `charmcraft build` silently omits files called out in `charmcraft.yaml` if executed from an external directory charmcraft closed Fixed by merged PR canonical/charmcraft#525 (merge commit 0d78f540), which runs the parts lifecycle from the project directory so relative globbed paths resolve during external builds.
72%
#2361 charmcraft errors out when mixing -p and -o flags charmcraft closed Fixed by merged PR #2600 (commit 868da353): pack now handles matching project/output directories correctly. Regression coverage was added by merged PR #2735 (commit 8ef26978).
71%