fix: map 'timed out' race rejection to 504 instead of generic 500#80
Open
eprouveze wants to merge 1 commit into
Open
fix: map 'timed out' race rejection to 504 instead of generic 500#80eprouveze wants to merge 1 commit into
eprouveze wants to merge 1 commit into
Conversation
|
@eprouveze is attempting to deploy a commit to the sculpt Team on Vercel. A member of the Team first needs to authorize it. |
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 submit route's own 25s timeout race rejects with the message
"Database operation timed out", but the error mapping below only checks for the substrings"timeout"and"deadline"—"timed out"(with a space) matches neither. So when a large-history merge blows the 25s window, the client gets the generic catch-all 500 "Failed to submit data. Please check your cc.json file format..." instead of the intended 504 "Request timed out. Please try again or submit smaller batches of data."That message difference matters: the 500 sends users down a payload-format rabbit hole, while the 504 tells them the actual fix (smaller batches).
How I hit this
My account (
eprouveze) has a ~188-day history. Since the #43/#79 per-machine merge deploy,mergeWithExistingruns one sequentialdaily_breakdownsround-trip per incoming day, so a full-history re-submit merging into an existing ~180-day record can exceed the 25s race. Every attempt returned the generic 500 with a payload that field-diffs identical to my last accepted submission (June 10, pre-deploy) — I only found the real cause by reading this route's source. Splitting the same data into ≤60-day chunks submits fine.Notes
"timed out"to the existing substring check (plus a comment tying it to the race above).mergeWithExisting(e.g. a single upsert on(submission_id, date)) would remove the timeout for long-history users entirely.🤖 Generated with Claude Code
https://claude.ai/code/session_01CprMNM6BjWgqLGcmCjZVZJ