Skip to content

fix: improve error message when daemon architecture doesn't match target#2520

Closed
niveshdandyan wants to merge 1 commit intobuildpacks:mainfrom
niveshdandyan:improve-daemon-target-error-message
Closed

fix: improve error message when daemon architecture doesn't match target#2520
niveshdandyan wants to merge 1 commit intobuildpacks:mainfrom
niveshdandyan:improve-daemon-target-error-message

Conversation

@niveshdandyan
Copy link

Summary

This PR improves the error message when a user attempts to build a builder or buildpack for a different architecture than the Docker daemon supports (e.g., building linux/amd64 on an arm64 Mac).

Before:

ERROR: could not find a target that matches daemon os=linux and architecture=arm64

After:

ERROR: unable to save image to docker daemon: the specified target(s) 'linux/amd64', 'windows/amd64' do not match the daemon's os/architecture 'linux/arm64'. To build for a different platform than the daemon, use the --publish flag to push directly to a registry

Changes

  • Updated daemonTarget function in pkg/client/package_buildpack.go to provide a more informative error message that:
    1. Lists which targets were specified that couldn't match
    2. Shows the daemon's current os/architecture
    3. Suggests using the --publish flag as a workaround
  • Updated test assertions in pkg/client/create_builder_test.go and pkg/client/package_buildpack_test.go to match the new error message format

Test plan

  • Verified test assertions were updated to match new error message
  • Manual testing: Build a builder with --target linux/amd64 on an arm64 machine without --publish flag - should see improved error message

🤖 Generated with Claude Code

@niveshdandyan niveshdandyan requested review from a team as code owners February 3, 2026 10:05
@github-actions github-actions bot added this to the 0.40.0 milestone Feb 3, 2026
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Feb 3, 2026
When a user attempts to build a builder or buildpack for a different
architecture than the Docker daemon supports (e.g., building linux/amd64
on an arm64 Mac), the error message was not helpful. It only indicated
that no target matched without explaining what was requested or how to
resolve the issue.

This commit improves the error message to:
1. List which targets were specified that couldn't match
2. Show the daemon's current os/architecture
3. Suggest using the --publish flag as a workaround

Fixes #2428

Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
Signed-off-by: niveshdandyan <niveshdandyan@gmail.com>
@niveshdandyan niveshdandyan force-pushed the improve-daemon-target-error-message branch from ae0b7a2 to 90b7aff Compare February 3, 2026 11:56
@jjbustamante jjbustamante modified the milestones: 0.40.0, 0.41.0 Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/enhancement Issue that requests a new feature or improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments