Skip to content

fix: don't classify success log lines as errors in log viewer#4594

Open
ravindu0823 wants to merge 2 commits into
Dokploy:canaryfrom
ravindu0823:fix/log-viewer-success-marked-as-error
Open

fix: don't classify success log lines as errors in log viewer#4594
ravindu0823 wants to merge 2 commits into
Dokploy:canaryfrom
ravindu0823:fix/log-viewer-success-marked-as-error

Conversation

@ravindu0823

Copy link
Copy Markdown

What

The Docker log viewer colors lines red ("error") when the line text contains the words error or failed, even when the line explicitly reports success. For example, ofelia's job-completion summary:

... NOTICE [Job "sync-1m" (...)] Finished in "326.16795ms", failed: false, skipped: false, error: none

is a successful run (failed: false, error: none) yet renders red.

Root cause

In apps/dokploy/components/dashboard/docker/logs/utils.ts, getLogType does purely keyword-based matching. The error branch fires on:

  • /(?:^|\s)(?:error|err):?\s/i — matches error: in error: none
  • /\b(?:fail(?:ed|ure)?|broken|dead)\b/i — matches failed in failed: false

The 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|0

This keeps the change minimal and does not regress genuine error detection: failed: true, error: connection refused, [ERROR] ..., Uncaught Exception, etc. still classify as error.

Test

Added apps/dokploy/__test__/utils/log-type.test.ts using real example lines from the issue. Confirmed RED before the fix (the success line returned error) and GREEN after:

✓ __test__/utils/log-type.test.ts (4 tests)
  Test Files  1 passed (1)
       Tests  4 passed (4)

pnpm --filter=dokploy run typecheck is clean.

Fixes #4538

🤖 Generated with Claude Code

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>
@ravindu0823 ravindu0823 requested a review from Siumauricio as a code owner June 9, 2026 09:09
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 9, 2026
… 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>
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 9, 2026
@vadamk

vadamk commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log viewer classifies successful lines as "error" (red)

2 participants