Skip to content

fix: include docker stderr in error messages#278

Merged
peterj merged 2 commits intoagentregistry-dev:mainfrom
optimus-fulcria:fix/docker-stderr-in-error
Mar 12, 2026
Merged

fix: include docker stderr in error messages#278
peterj merged 2 commits intoagentregistry-dev:mainfrom
optimus-fulcria:fix/docker-stderr-in-error

Conversation

@optimus-fulcria
Copy link
Copy Markdown
Contributor

@optimus-fulcria optimus-fulcria commented Mar 6, 2026

Description

When Docker commands fail, only stdout was captured, making it difficult to diagnose build and deployment failures. Docker typically writes error details to stderr.

The Executor.Run method in docker.go now uses io.MultiWriter(os.Stderr, &stderrBuf) to both display stderr in real time and capture it for inclusion in the returned error message when the command fails.

To reduce log pollution, outputs are now backed by --verbose flag. Following a similar approach to the agentregistry-runtime, we print to both stderr + buffer error when verbose is enabled, else we simply output the buffer-captured error with the returned error message.

Fixes #193

Validation

# init a skill
go run cmd/cli/main.go skill init test

Non-verbose output would only log the captured docker error

# invalid build without verbose logging
go run cmd/cli/main.go skill build test --image 'invalid!!tag'
Building skill "hello-world-template" as Docker image: invalid!!tag
Error: build failed for skill "hello-world-template": docker build failed: exit status 1
ERROR: failed to build: invalid tag "invalid!!tag": invalid reference format
exit status 1

Verbose output will log std logs, the stderr, and final captured docker error (which technically leads to duplicated from stderr + captured err returned)

# invalid skill with verbose logging
go run cmd/cli/main.go skill build test --image 'invalid!!tag' --verbose
Building skill "hello-world-template" as Docker image: invalid!!tag
Running: docker build -t invalid!!tag -f /var/folders/zy/pkk0_2ys5yx8y1syxw5xjxhh0000gn/T/skill-dockerfile-654053150 /Users/fabiangonz98/go/src/github.com/solo-io/agentregistry/test
Working directory: /Users/fabiangonz98/go/src/github.com/solo-io/agentregistry/test
ERROR: failed to build: invalid tag "invalid!!tag": invalid reference format
Error: build failed for skill "hello-world-template": docker build failed: exit status 1
ERROR: failed to build: invalid tag "invalid!!tag": invalid reference format
exit status 1

Change Type

/kind fix

Changelog

Include docker stderr in error messages for better debugging

Additional Notes

@peterj
Copy link
Copy Markdown
Contributor

peterj commented Mar 6, 2026

please update the PR template

Copy link
Copy Markdown
Contributor

@peterj peterj left a comment

Choose a reason for hiding this comment

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

please update the PR template

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

PR description has been updated to match the template (Description, Change Type, Changelog, Additional Notes sections).

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

3 similar comments
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

Capture stderr from docker commands via io.MultiWriter so that when a
docker build, push, or pull fails the error message includes the actual
docker error output. Stderr is still streamed to the terminal in real
time so interactive UX is unchanged.

Fixes agentregistry-dev#193

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions
Copy link
Copy Markdown

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

1 similar comment
@github-actions
Copy link
Copy Markdown

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

Updated the PR template and rebased on latest main. The buildSkillDockerImage function was removed upstream, so the publish.go changes are no longer needed. The stderr capture now lives centrally in Executor.Run in docker.go, which handles all docker commands (build, push, pull, etc.).

@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

PR template has been updated to follow the standard format (Description, Change Type, Changelog, Additional Notes). Ready for re-review.

@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

@peterj The PR description has been updated to follow the standard template format (Description, Change Type, Changelog, Additional Notes). Ready for re-review.

@github-actions
Copy link
Copy Markdown

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

Updated PR description to match the template. Ready for re-review.

@github-actions
Copy link
Copy Markdown

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

2 similar comments
@github-actions
Copy link
Copy Markdown

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link
Copy Markdown

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

Signed-off-by: Fabian Gonzalez <[email protected]>
@inFocus7 inFocus7 force-pushed the fix/docker-stderr-in-error branch from 97e1bf0 to ba4a5d7 Compare March 11, 2026 21:28
@peterj peterj added this pull request to the merge queue Mar 12, 2026
Merged via the queue into agentregistry-dev:main with commit 573bb30 Mar 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing skill shows unhelpful 'exit status 1' on docker failures

3 participants