Skip to content

fix(image): surface ENOSPC immediately on podman image load#28404

Closed
DeveshB-1 wants to merge 2 commits intocontainers:mainfrom
DeveshB-1:fix/image-load-enospc-error
Closed

fix(image): surface ENOSPC immediately on podman image load#28404
DeveshB-1 wants to merge 2 commits intocontainers:mainfrom
DeveshB-1:fix/image-load-enospc-error

Conversation

@DeveshB-1
Copy link
Copy Markdown
Contributor

Description

Fixes #26197

When disk space runs out during podman image load, the error chain was swallowed by the image format detection loop and the user saw a misleading message:

Error: payload does not match any of the supported image formats:
 * dir: ...
 * docker-archive: ...

Instead of the real cause: no space left on device.

Fix

In the transport load loop inside vendor/go.podman.io/common/libimage/load.go, check each transport error for "no space left on device" before appending to the generic error list. Return syscall.ENOSPC immediately so callers and users see the real cause.

The error arrives as a string from a subprocess so errors.Is(err, syscall.ENOSPC) does not work directly — string matching is the approach suggested by @Luap99 in the issue.

Before / After

# Before
$ podman image load < large.tar  # disk full
Error: payload does not match any of the supported image formats: ...

# After
$ podman image load < large.tar  # disk full
Error: loading image: no space left on device

When disk space runs out during "podman image load", the error was
buried in the image format detection loop and the user saw a misleading
"payload does not match any of the supported image formats" error
instead of the real cause.

Detect "no space left on device" in each transport error and return
syscall.ENOSPC immediately so callers and users see the real cause.

Fixes: containers#26197

Signed-off-by: Devesh B <98201065+DeveshB-1@users.noreply.github.com>
The previous commit modified vendor/go.podman.io/common/libimage/load.go
directly, which causes `make vendor` to report a dirty tree and fail the
postbuild CI check.

Move the "no space left on device" → syscall.ENOSPC wrapping into the
non-vendored (*ImageEngine).Load wrapper in
pkg/domain/infra/abi/images.go, and restore the vendor file to its
canonical upstream state.

Add a unit test (TestLoadImageENOSPCWrapping) that confirms the inline
check maps the ENOSPC string to syscall.ENOSPC and leaves other errors
unchanged.

Signed-off-by: Devesh B <98201065+DeveshB-1@users.noreply.github.com>
@DeveshB-1 DeveshB-1 force-pushed the fix/image-load-enospc-error branch from ed1c79c to 98bcc07 Compare March 29, 2026 18:46
@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@DeveshB-1
Copy link
Copy Markdown
Contributor Author

@mheon all 81 CI checks are passing on this one. Would you mind taking a look and merging if it looks good? Thanks!

Copy link
Copy Markdown
Member

@danishprakash danishprakash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already some work done on this - containers/container-libs#419. I believe c/c-libs is better suited for this fix.

@DeveshB-1
Copy link
Copy Markdown
Contributor Author

got it no worries

@DeveshB-1
Copy link
Copy Markdown
Contributor Author

DeveshB-1 commented Mar 30, 2026

can work on containers/container-libs#419 if its alright @danishprakash

@DeveshB-1
Copy link
Copy Markdown
Contributor Author

@danishprakash - looked into containers/container-libs#419. The reviewers (Luap99, mtrmac) flagged that the approach there discards the original error context and guesses the affected path. That PR has been stalled since February with the feedback unaddressed.

Our fix here is in pkg/domain/infra/abi/images.go at the podman layer: it checks the error message for "no space left on device" and wraps it with syscall.ENOSPC (preserving the original via %w), making it detectable via errors.Is. The error context is not discarded.

Happy to move the fix to container-libs instead if you prefer - but given the state of #419, would it be okay to move forward with this approach here?

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please read https://github.com/containers/podman/blob/main/LLM_POLICY.md and our contributing guidelines

Just looking at this change I do not think string matches in podman here are good at all. At the very least we should optimize the loading code in libimage to abort the loading early and return useful errors there like discussed in containers/container-libs#419

@Luap99 Luap99 closed this Apr 1, 2026
@DeveshB-1 DeveshB-1 deleted the fix/image-load-enospc-error branch April 1, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

podman image load fails with Error: payload does not match any of the supported image formats: on a system with low disk space

3 participants