Skip to content

fix(core): retry TASK_MIDDLEWARE_ERROR under the task's retry policy#11

Open
deepshekhardas wants to merge 1 commit into
mainfrom
fix/3676-retry-middleware-errors
Open

fix(core): retry TASK_MIDDLEWARE_ERROR under the task's retry policy#11
deepshekhardas wants to merge 1 commit into
mainfrom
fix/3676-retry-middleware-errors

Conversation

@deepshekhardas
Copy link
Copy Markdown
Owner

@deepshekhardas deepshekhardas commented May 24, 2026

Adds TASK_MIDDLEWARE_ERROR to shouldLookupRetrySettings so it is retried under the task's retry policy instead of failing the run on the first attempt.

The error was already classified as retryable by shouldRetryError, but shouldLookupRetrySettings did not include it, so the retry flow fell through to fail_run.

Closes triggerdotdev#3676


Summary by cubic

Retries TASK_MIDDLEWARE_ERROR under the task's retry policy in @trigger.dev/core, preventing runs from failing on the first attempt. Aligns shouldLookupRetrySettings with shouldRetryError so middleware errors follow task backoff.

  • Bug Fixes
    • Included TASK_MIDDLEWARE_ERROR in shouldLookupRetrySettings to use task retry/backoff.
    • Added a unit test to verify retry behavior for this error.

Written for commit ab651f8. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/core/src/v3/errors.ts">

<violation number="1" location="packages/core/src/v3/errors.ts:647">
P2: User-facing error text contains a garbled replacement character (`�`), which degrades message readability.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

`over the realtime stream's per-record cap of ${maxSize} bytes. ` +
`For oversized payloads (e.g. large tool outputs), write the value to your own store and ` +
`emit only an id/url through the chat stream see https://trigger.dev/docs/ai-chat/patterns/large-payloads.`
`emit only an id/url through the chat stream see https://trigger.dev/docs/ai-chat/patterns/large-payloads.`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: User-facing error text contains a garbled replacement character (), which degrades message readability.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/src/v3/errors.ts, line 647:

<comment>User-facing error text contains a garbled replacement character (`�`), which degrades message readability.</comment>

<file context>
@@ -641,7 +644,7 @@ export class ChatChunkTooLargeError extends Error {
         `over the realtime stream's per-record cap of ${maxSize} bytes. ` +
         `For oversized payloads (e.g. large tool outputs), write the value to your own store and ` +
-        `emit only an id/url through the chat stream — see https://trigger.dev/docs/ai-chat/patterns/large-payloads.`
+        `emit only an id/url through the chat stream � see https://trigger.dev/docs/ai-chat/patterns/large-payloads.`
     );
     this.name = "ChatChunkTooLargeError";
</file context>
Suggested change
`emit only an id/url through the chat stream see https://trigger.dev/docs/ai-chat/patterns/large-payloads.`
`emit only an id/url through the chat stream see https://trigger.dev/docs/ai-chat/patterns/large-payloads.`

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.

1 participant