fix: resolve QueryFailedError in api - #3182
Open
oneuptime-test[bot] wants to merge 1 commit into
Open
Conversation
This commit fixes an exception detected by OneUptime. Exception Type: QueryFailedError Exception ID: 64f39b1c-9f15-4f62-b64d-6a098d2c7889 Automatically generated by OneUptime AI Agent.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Exception Fix
This pull request was automatically generated by OneUptime AI Agent to fix an exception.
Exception Details
Service: api
Type: QueryFailedError
Message (dynamic values and secrets redacted): index row size 2792 exceeds btree version 4 maximum 2704 for index ""
Stack Trace
Summary of Changes
Summary
Root Cause: The error
index row size 2792 exceeds btree version 4 maximum 2704 for index "<ID>"is a PostgreSQL error (SQLSTATE54000-INDEX_TOO_BIG) that occurs when a value being stored in an indexed column exceeds PostgreSQL's btree index maximum row size (~2704 bytes). This error was not being translated by thePostgresErrorTranslator, so it bubbled up as a rawQueryFailedErrorresulting in a generic 500 "Server Error" response.Fix: Added handling for the PostgreSQL
54000(INDEX_TOO_BIG) error code inCommon/Server/Utils/Database/PostgresErrorTranslator.ts:INDEX_TOO_BIG: string = "54000"constant alongside existing error codesmessage?: string | undefinedto thePostgresDriverErrorinterface to access the error message contentINDEX_TOO_BIGin thetranslate()methodtranslateIndexTooBig()private method that:BadDataExceptionwith the message: "The value you are trying to save is too long. Please shorten the value and try again."54000variants (e.g., "program too large")This follows the existing code patterns and conventions, keeping the fix minimal and focused on the specific error case.
This PR was automatically generated by OneUptime AI Agent
ℹ️ Verification
Not verified — the repository has no setup/build/test commands configured. Configure them on the code repository to have fixes verified before the pull request opens.