Skip to content

history logs: print error summary at end of output#3756

Draft
thompson-shaun wants to merge 1 commit intodocker:masterfrom
thompson-shaun:sandbox/a8b8f31e
Draft

history logs: print error summary at end of output#3756
thompson-shaun wants to merge 1 commit intodocker:masterfrom
thompson-shaun:sandbox/a8b8f31e

Conversation

@thompson-shaun
Copy link
Copy Markdown
Collaborator

@thompson-shaun thompson-shaun commented Mar 30, 2026

Closes #3132

When a build fails, history logs now prints an error summary after
all progress output, matching the error detail already shown by
history inspect. This includes the error message, source location
(e.g. the failing Dockerfile line), logs from the failed vertex, and
a stack trace hint. Particularly useful for cache key computation
failures where no vertex logs appear during the main log replay.

Extracts loadBuildErrorOutput and printErrorDetails as shared helpers
so both commands use the same formatting logic.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Before:

#1 [internal] load build definition from Dockerfile
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/python:3.11
#2 DONE 1.2s

#3 [1/3] FROM docker.io/library/python:3.11
#3 DONE 0.0s

#4 [2/3] RUN pip install -r requirements.txt
#4 0.831 ERROR: Could not find a version that satisfies the requirement badpkg==99.0 (from -r requirements.txt)
#4 ERROR: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
------
 > [2/3] RUN pip install -r requirements.txt:
0.831 ERROR: Could not find a version that satisfies the requirement badpkg==99.0
------

(no indication of what went wrong — you'd have to run history inspect separately)


After:

#1 [internal] load build definition from Dockerfile
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/python:3.11
#2 DONE 1.2s

#3 [1/3] FROM docker.io/library/python:3.11
#3 DONE 0.0s

#4 [2/3] RUN pip install -r requirements.txt
#4 0.831 ERROR: Could not find a version that satisfies the requirement badpkg==99.0 (from -r requirements.txt)
#4 ERROR: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
------
 > [2/3] RUN pip install -r requirements.txt:
0.831 ERROR: Could not find a version that satisfies the requirement badpkg==99.0
------

Error: Unknown failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
------
 > [2/3] RUN pip install -r requirements.txt:
------
Dockerfile:6
--------------------
   4 |        COPY requirements.txt .
   5 |
   6 | >>> RUN pip install -r requirements.txt
   7 |
--------------------
Logs:
> => [2/3] RUN pip install -r requirements.txt:
> ERROR: Could not find a version that satisfies the requirement badpkg==99.0

Enable --debug to see stack traces for error

When a build fails, `history logs` now prints an error summary after
all progress output, matching the error detail already shown by
`history inspect`. This includes the error message, source location
(e.g. the failing Dockerfile line), logs from the failed vertex, and
a stack trace hint. Particularly useful for cache key computation
failures where no vertex logs appear during the main log replay.

Extracts loadBuildErrorOutput and printErrorDetails as shared helpers
so both commands use the same formatting logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Shaun Thompson <30006198+thompson-shaun@users.noreply.github.com>
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.

Always print error in the end of history logs command

1 participant