AttributeError: 'SubprocessError' object has no attribute 'message'
Metadata
Current evaluation
Fixed by merged PR #2349 in commit d4cd94ff, replacing invalid SubprocessError.message access with correctly surfaced skopeo error details.
Resolution: closed resolved
Reason: PR #2349 was merged and explicitly fixed #2077. Commit d4cd94ff now reports the underlying skopeo inspection failure instead of raising AttributeError.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
`charmcraft upload-resource --format json spark-integration-hub-k8s integration-hub-image --image docker://ghcr.io/canonical/spark-integration-hub:3.4-22.04_edge@sha256:0b9a40435440256b1c10020bd59d19e186ea68d8973fc8f2310010f9bd4e3459` raises AttributeError
Guessing issue might be tag & digest used in docker uri instead of digest only
### Expected behavior
charmcraft raises a more detailed error message
### To Reproduce
CI logs: https://github.com/canonical/spark-integration-hub-k8s-operator/actions/runs/12766410882/attempts/6
```
git clone https://github.com/canonical/spark-integration-hub-k8s-operator
cd spark-integration-hub-k8s-operator
git checkout e5e5cee8da7c6a05ea56cc88647c561c21620472
charmcraft upload-resource --format json spark-integration-hub-k8s integration-hub-image --image docker://ghcr.io/canonical/spark-integration-hub:3.4-22.04_edge@sha256:0b9a40435440256b1c10020bd59d19e186ea68d8973fc8f2310010f9bd4e3459
```
### Environment
Ubuntu 24.04 (github runner)
```
$ snap list
Name Version Rev Tracking Publisher Notes
charmcraft 3.2.2.post137+ge820f399 5706 latest/beta/… canonical** classic
core22 20241119 1722 latest/stable canonical** base
snapd 2.67 23545 latest/stable canonical** snapd
```
### charmcraft.yaml
```yaml
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
platforms:
ubuntu@22.04:amd64:
# Files implicitly created by charmcraft without a part:
# - dispatch (https://github.com/canonical/charmcraft/pull/1898)
# - manifest.yaml
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L259)
# Files implicitly copied/"primed" by charmcraft without a part:
# - actions.yaml, config.yaml, metadata.yaml
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L290-L293
# https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L156-L157)
parts:
# "poetry-deps" part name is a magic constant
# https://github.com/canonical/craft-parts/pull/901
poetry-deps:
plugin: nil
build-packages:
- curl
override-build: |
# Use environment variable instead of `--break-system-packages` to avoid failing on older
# versions of pip that do not recognize `--break-system-packages`
# `--user` needed (in addition to `--break-system-packages`) for Ubuntu >=24.04
PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==24.3.1 # renovate: charmcraft-pip-latest
# Use uv to install poetry so that a newer version of Python can be installed if needed by poetry
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh # renovate: charmcraft-uv-latest
# poetry 2.0.0 requires Python >=3.9
if ! "$HOME/.local/bin/uv" python find '>=3.9'
then
# Use first Python version that is >=3.9 and available in an Ubuntu LTS
# (to reduce the number of Python versions we use)
"$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04
fi
"$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.0.0 --with poetry-plugin-export==1.8.0 # renovate: charmcraft-poetry-latest
ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry
# "charm-poetry" part name is arbitrary; use for consistency
# Avoid using "charm" part name since that has special meaning to charmcraft
charm-poetry:
# By default, the `poetry` plugin creates/primes these directories:
# - lib, src
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L76-L78)
# - venv
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L95
# https://github.com/canonical/craft-parts/blob/afb0d652eb330b6aaad4f40fbd6e5357d358de47/craft_parts/plugins/base.py#L270)
plugin: poetry
source: .
after:
- poetry-deps
poetry-export-extra-args: ['--only', 'main,charm-libs']
build-packages:
- libffi-dev # Needed to build Python dependencies with Rust from source
- libssl-dev # Needed to build Python dependencies with Rust from source
- pkg-config # Needed to build Python dependencies with Rust from source
override-build: |
# Workaround for https://github.com/canonical/charmcraft/issues/2068
# rustup used to install rustc and cargo, which are needed to build Python dependencies with Rust from source
if [[ "$CRAFT_PLATFORM" == ubuntu@20.04:* || "$CRAFT_PLATFORM" == ubuntu@22.04:* ]]
then
snap install rustup --classic
else
apt-get install rustup -y
fi
# If Ubuntu version < 24.04, rustup was installed from snap instead of from the Ubuntu
# archive—which means the rustup version could be updated at any time. Print rustup version
# to build log to make changes to the snap's rustup version easier to track
rustup --version
# rpds-py (Python package) >=0.19.0 requires rustc >=1.76, which is not available in the
# Ubuntu 22.04 archive. Install rustc and cargo using rustup instead of the Ubuntu archive
rustup set profile minimal
rustup default 1.83.0 # renovate: charmcraft-rust-latest
craftctl default
# Include requirements.txt in *.charm artifact for easier debugging
cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt"
# "files" part name is arbitrary; use for consistency
files:
plugin: dump
source: .
prime:
- LICENSE
```
### Relevant log output
```shell
2025-01-14 13:41:10.778 Starting charmcraft, version 3.2.2.post137+ge820f399
2025-01-14 13:41:10.778 Log verbosity level set to BRIEF
2025-01-14 13:41:10.778 Preparing application...
2025-01-14 13:41:10.778 Configuring application...
2025-01-14 13:41:10.779 Setting up ConfigService
2025-01-14 13:41:10.788 Build plan: platform=None, build_for=None
2025-01-14 13:41:10.788 Running charmcraft upload-resource on host
2025-01-14 13:41:10.789 Storing credentials for 'charmcraft' on 'api.charmhub.io' in keyring 'auth MemoryKeyring'.
2025-01-14 13:41:10.790 Getting image
2025-01-14 13:41:10.790 Trying to get image from Docker
2025-01-14 13:41:10.790 Setting up ImageService
2025-01-14 13:41:11.462 Image not found in local Docker
2025-01-14 13:41:11.462 Presuming an OCI path that skopeo understands.
2025-01-14 13:41:11.462 Using source path 'docker://ghcr.io/canonical/spark-integration-hub:3.4-22.04_edge@sha256:0b9a40435440256b1c10020bd59d19e186ea68d8973fc8f2310010f9bd4e3459'
2025-01-14 13:41:11.462 Inspecting source image
2025-01-14 13:41:11.474 charmcraft internal error: AttributeError("'SubprocessError' object has no attribute 'message'")
2025-01-14 13:41:11.480 Traceback (most recent call last):
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/charmcraft/utils/skopeo.py", line 78, in _run_skopeo
2025-01-14 13:41:11.480 return subprocess.run(command, check=True, **kwargs)
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/usr/lib/python3.10/subprocess.py", line 526, in run
2025-01-14 13:41:11.480 raise CalledProcessError(retcode, process.args,
2025-01-14 13:41:11.480 subprocess.CalledProcessError: Command '['/snap/charmcraft/5706/libexec/charmcraft/skopeo', '--insecure-policy', 'inspect', '--raw', 'docker://ghcr.io/canonical/spark-integration-hub:3.4-22.04_edge@sha256:0b9a40435440256b1c10020bd59d19e186ea68d8973fc8f2310010f9bd4e3459']' returned non-zero exit status 1.
2025-01-14 13:41:11.480
2025-01-14 13:41:11.480 The above exception was the direct cause of the following exception:
2025-01-14 13:41:11.480 Traceback (most recent call last):
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/charmcraft/services/image.py", line 149, in inspect
2025-01-14 13:41:11.480 raw_manifest = self._skopeo.inspect(image, raw=True)
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/charmcraft/utils/skopeo.py", line 156, in inspect
2025-01-14 13:41:11.480 result = self._run_skopeo(command, capture_output=True, text=True)
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/charmcraft/utils/skopeo.py", line 80, in _run_skopeo
2025-01-14 13:41:11.480 raise errors.SubprocessError.from_subprocess(exc) from exc
2025-01-14 13:41:11.480 charmcraft.errors.SubprocessError: Error while running /snap/charmcraft/5706/libexec/charmcraft/skopeo (return code 1)
2025-01-14 13:41:11.480
2025-01-14 13:41:11.480 During handling of the above exception, another exception occurred:
2025-01-14 13:41:11.480 Traceback (most recent call last):
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/craft_application/application.py", line 668, in run
2025-01-14 13:41:11.480 return_code = self._run_inner()
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/craft_application/application.py", line 649, in _run_inner
2025-01-14 13:41:11.480 return_code = dispatcher.run() or os.EX_OK
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 494, in run
2025-01-14 13:41:11.480 return self._loaded_command.run(self._parsed_command_args)
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/charmcraft/application/commands/store.py", line 2103, in run
2025-01-14 13:41:11.480 image_metadata = image_service.inspect(source_path)
2025-01-14 13:41:11.480 File "/snap/charmcraft/5706/lib/python3.10/site-packages/charmcraft/services/image.py", line 153, in inspect
2025-01-14 13:41:11.480 "Could not inspect OCI image.", details=f"{exc.message}\n{exc.details}"
2025-01-14 13:41:11.480 AttributeError: 'SubprocessError' object has no attribute 'message'
2025-01-14 13:41:11.480 Full execution log: '/home/runner/.local/state/charmcraft/log/charmcraft-20250114-134110.777571.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #2349 in commit d4cd94ff, replacing invalid SubprocessError.message access with correctly surfaced skopeo error details. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #2349 (commit d4cd94ff), which corrected SubprocessError handling and surfaced the underlying skopeo inspection error. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/charmcraft#2349 (commit d4cd94ff), which corrected SubprocessError message handling during skopeo image inspection and exposed the underlying error. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed SubprocessError handling in merged PR #2349 (commit d4cd94ff), so skopeo image inspection failures now report the underlying error instead of an AttributeError. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/charmcraft#2349 (commit d4cd94ff), correcting SubprocessError handling so skopeo inspection failures show the underlying message instead of an AttributeError. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #2349 in commit d4cd94ff, replacing the SubprocessError AttributeError with the underlying skopeo error message. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved in PR #2349. The AttributeError triggered when accessing .message on SubprocessError during image inspection was fixed, restoring proper error message presentation. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in PR #2349 by fixing the exception handling logic to correctly access error details, replacing the AttributeError with the proper underlying skopeo error message. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in PR #2349 by correcting error handling to display the actual subprocess failure message instead of crashing with an AttributeError during OCI image inspection with tag and digest URIs. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed via PR #2349. The AttributeError triggered by accessing the non-existent .message attribute on SubprocessError was resolved, enabling proper error message display during OCI image inspection. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in PR #2349. The AttributeError caused by accessing exc.message during image inspection was resolved, enabling proper error reporting instead of a crash. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#2349
(confidence 100%)
Merged fix for the SubprocessError handling, recorded in commit d4cd94ff.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2349 fix: correct the error message with skopeo errors. | charmcraft | merged | Merged PR #2349 fixed #2077 in commit d4cd94ff by correctly handling SubprocessError and surfacing the underlying skopeo error. |