fix(http): make handler-error status visible in access log + transcription errors#9707
Merged
mudler merged 2 commits intoMay 7, 2026
Merged
Conversation
The custom xlog access-log middleware in API() reads res.Status *before* Echo's central HTTPErrorHandler runs, so when a handler returns an error without writing a response (e.g. TranscriptEndpoint's `return err` on backend failure) the status field stays at its default 200. The logged line then claims status=200 while the client receives 500 — silently hiding every 500/503/etc. that bubbles up through Echo's error handler. Mirror echo.DefaultHTTPErrorHandler's status derivation when err != nil and the response hasn't been committed: default to 500, upgrade to *echo.HTTPError.Code if applicable. The logged status now matches what the client actually sees, so failed transcription requests stop appearing as 200 in the access log. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-7 [Claude Code]
ModelTranscriptionWithOptions surfaces real failures — gRPC errors from a remote node, model load problems, ffmpeg conversion crashes — but TranscriptEndpoint just did `return err`, so Echo turned it into a 500 with a generic body and the original error was lost. Operators chasing transcription failures across distributed mode were left with "upstream returned 500" on the client and zero context anywhere in the frontend's logs. Add an xlog.Error before returning, recording model name, the staged audio path, and the underlying error. Combined with the access-log status fix, a failing transcription now leaves an audit trail (real status code in the access line, real cause in an Error line) instead of vanishing. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-7 [Claude Code]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small, focused fixes that together close an observability gap around transcription failures (and any handler that returns
errto Echo's central error handler).fix(http): log accurate status code when handler returns error— The custom xlog access-log middleware inAPI()readsres.Statusbefore Echo's centralHTTPErrorHandlerruns, so when a handler returns an error without writing a response, the status field stays at its default200. Every 500/503/etc. that flows through Echo's error handler was silently logged as200. Now mirrorsecho.DefaultHTTPErrorHandler's derivation: default to 500, upgrade to*echo.HTTPError.Codeif applicable.fix(transcription): log underlying error before returning 500 to client—TranscriptEndpointdidreturn erron backend failure; the actual error (gRPC error from a remote node, model load issue, ffmpeg crash, etc.) was lost. Now logs model name, staged audio path, and the underlying error before returning.Why these together
Operators chasing transcription failures across distributed mode were getting
"upstream returned 500"on the client, status=200 in the access log, and zero context anywhere in the frontend's logs. With both fixes:Test plan
Transcription failed ... error=...and an access-log line withstatus=500.status=200(no regression).🤖 Generated with Claude Code