fix: don't classify success log lines as errors in log viewer#4594
Open
ravindu0823 wants to merge 2 commits into
Open
fix: don't classify success log lines as errors in log viewer#4594ravindu0823 wants to merge 2 commits into
ravindu0823 wants to merge 2 commits into
Conversation
The log viewer's getLogType classified any line containing the words
"error" or "failed" as an error, ignoring the value that follows. Lines
that report success, such as ofelia's job summary
("failed: false, skipped: false, error: none"), were rendered red.
Strip "no-error" key/value pairs (error: none|null|false|0|...,
failed: false|0|no) before applying the error keyword regexes, so a
legitimate success line is no longer flagged while genuine errors
(failed: true, error: <msg>) are still detected.
Fixes Dokploy#4538
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… prefix Address review: the no-error stripping was anchored with a trailing \b, so a value that merely STARTS with none/no/nil/0/false (e.g. "failed: no route to host", "error: none of the nodes responded", "error: nil pointer dereference") got its error key stripped and was misclassified as non-error — a regression in genuine error highlighting. Anchor the no-error value to a real value terminator (end-of-line, comma or semicolon) so only the complete value is stripped. This also revives the previously dead "-", "" and '' alternatives (a \b could never follow them). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
+1 |
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.
What
The Docker log viewer colors lines red ("error") when the line text contains the words
errororfailed, even when the line explicitly reports success. For example, ofelia's job-completion summary:is a successful run (
failed: false,error: none) yet renders red.Root cause
In
apps/dokploy/components/dashboard/docker/logs/utils.ts,getLogTypedoes purely keyword-based matching. The error branch fires on:/(?:^|\s)(?:error|err):?\s/i— matcheserror:inerror: none/\b(?:fail(?:ed|ure)?|broken|dead)\b/i— matchesfailedinfailed: falseThe matchers look at the key only and ignore the value that follows, so success lines are misclassified.
Fix
Before applying the error keyword regexes, strip "no-error" key/value pairs from the message:
error: none|null|nil|false|0|-|""|''failed|failure: false|no|none|0This keeps the change minimal and does not regress genuine error detection:
failed: true,error: connection refused,[ERROR] ...,Uncaught Exception, etc. still classify aserror.Test
Added
apps/dokploy/__test__/utils/log-type.test.tsusing real example lines from the issue. Confirmed RED before the fix (the success line returnederror) and GREEN after:pnpm --filter=dokploy run typecheckis clean.Fixes #4538
🤖 Generated with Claude Code