Skip to content

fix: improve error labelling, grouping, and stack traces in the Errors feature#4225

Merged
matt-aitken merged 1 commit into
mainfrom
fix/errors-message-fallback
Jul 10, 2026
Merged

fix: improve error labelling, grouping, and stack traces in the Errors feature#4225
matt-aitken merged 1 commit into
mainfrom
fix/errors-message-fallback

Conversation

@matt-aitken

@matt-aitken matt-aitken commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

Several display/grouping issues in the Errors feature, all rooted in how the ClickHouse error materialized views (errors_mv_v1, error_occurrences_mv_v1) read the stored error JSON produced by parseError:

  1. Messageless errors show "Unknown error". An empty message falls straight through coalesce(nullIf(message,''), 'Unknown error') to the literal, even though the error's class name is available (e.g. an Effect tagged error ListMessagesError with no message).
  2. Unrelated errors collapse into one group. calculateErrorFingerprint keys on type : message : stack, where type is always the union tag (BUILT_IN_ERROR, …), message is empty, and the stack isn't read — so every messageless built-in error (and every string/custom error) hashes to the same constant input → one fingerprint.
  3. error_type shows the internal tag. coalesce(type, name, …) always resolves to type (always present), so the column shows BUILT_IN_ERROR instead of the real class name.
  4. Stack traces never populate. The MVs read error.data.stack, but the serializer stores the trace under stackTrace — so the column is always empty.

Fix

All display changes are ALTER TABLE … MODIFY QUERY on the two views (migration 035); the fingerprint change is in the webapp.

  • Fingerprint (errorFingerprinting.ts): fall back message → name → raw. Messageless errors now group by class name (or raw value for non-Error throws); message-bearing errors are unchanged (short-circuits at message), so existing groups don't split — only currently-messageless errors get their own group going forward.
  • error_message: same message → name → raw fallback before 'Unknown error'.
  • error_type: coalesce name → code → 'Error' (drops the reliance on the union tag). Built-in → class name, internal → code, string/custom → Error.
  • stack trace: read error.data.stackTrace. Bounded as before (serializer caps 50 frames / 1024 chars per line; MV clips to 2000 chars).

Migration notes

  • MODIFY QUERY swaps the view query in place (no drop/recreate gap); Down restores the previous query.
  • Existing rows are left unchanged — changes apply only to rows inserted after the migration. No backfill.

Tests

errorFingerprinting.test.ts — 57 pass, incl. new cases for messageless class names, string/custom raw values, and stability of message-bearing fingerprints.

Fixes the display-derivation half of TRI-11938 (error_type + stack trace); relates to TRI-9254 and TRI-9250.

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b7efc4e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d8aa4f3d-53f1-4ab6-acbe-a4fbb586a32c

📥 Commits

Reviewing files that changed from the base of the PR and between e524cce and b7efc4e.

📒 Files selected for processing (4)
  • .server-changes/errors-message-fallback.md
  • apps/webapp/app/utils/errorFingerprinting.ts
  • apps/webapp/test/errorFingerprinting.test.ts
  • internal-packages/clickhouse/schema/035_fix_error_display_derivation.sql
✅ Files skipped from review due to trivial changes (2)
  • .server-changes/errors-message-fallback.md
  • apps/webapp/app/utils/errorFingerprinting.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/webapp/test/errorFingerprinting.test.ts
  • internal-packages/clickhouse/schema/035_fix_error_display_derivation.sql
📜 Recent review details
⏰ Context from checks skipped due to timeout. (24)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (9, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (12, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (10, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (11, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 10)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (5, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 10)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (8, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (1, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (4, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (7, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (2, 12)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (6, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 10)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (3, 12)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 10)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: typecheck / typecheck

Walkthrough

Error fingerprinting now falls back from an error message to its name or raw value, with tests covering grouping and precedence behavior. ClickHouse materialized views now derive error types, messages, and stack traces from updated error JSON fields, while migration down steps restore the previous derivation rules. A changelog entry documents the resulting Errors-page behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is informative, but it does not follow the required template or include the issue link, checklist, testing steps, changelog, and screenshots sections. Reformat the PR description to match the template and add Closes #, the checklist, testing steps, a short changelog, and a screenshots section.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main Errors feature change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/errors-message-fallback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

@matt-aitken matt-aitken force-pushed the fix/errors-message-fallback branch from 72e1c07 to e524cce Compare July 10, 2026 14:51
@matt-aitken matt-aitken changed the title fix: label and group errors without a message by their name fix: improve error labelling, grouping, and stack traces in the Errors feature Jul 10, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

Errors thrown without a message (e.g. tagged errors) and non-Error
throws (strings, plain objects) were all shown as "Unknown error" and
collapsed into a single fingerprint, so unrelated failures across
different tasks shared one group.

Fall back message -> name -> raw when computing both the error
fingerprint and the displayed message. Message-bearing errors are
unaffected, so existing groups don't split; only errors that currently
have no message get a meaningful title and their own group going forward.

Also fix two display-derivation bugs in the same error materialized
views (via MODIFY QUERY, existing rows unchanged):
- error_type now shows the real class name / internal code instead of
  the generic serialization tag (BUILT_IN_ERROR, STRING_ERROR, ...).
- stack traces now read the stored stackTrace field, not the always-empty
  error.data.stack, so they populate again.
@matt-aitken matt-aitken force-pushed the fix/errors-message-fallback branch from e524cce to b7efc4e Compare July 10, 2026 15:48
@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@b7efc4e

trigger.dev

npm i https://pkg.pr.new/trigger.dev@b7efc4e

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@b7efc4e

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@b7efc4e

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@b7efc4e

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@b7efc4e

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@b7efc4e

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@b7efc4e

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@b7efc4e

commit: b7efc4e

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Open in Devin Review

@matt-aitken matt-aitken merged commit 2cac63f into main Jul 10, 2026
53 checks passed
@matt-aitken matt-aitken deleted the fix/errors-message-fallback branch July 10, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants