cells job fails with PG::NumericValueOutOfRange: ERROR: integer out of range error
Job #11295770239 failed for dfd53efa:
Troubleshooting done by GitLab Duo:
Root cause of failure
The job failed due to a PostgreSQL database error during the database seeding process. The root cause is a PG::NumericValueOutOfRange: ERROR: integer out of range error that occurred while trying to insert data into the database.
The sequence of events leading to the failure:
- The job was running database seeding operations using
rake db:seed_fu - During the seeding of merge requests (in the
10_merge_requests.rbfixture file), the system attempted to create merge requests for various projects - While processing merge request creation, the code tried to check the
auto_duo_code_review_enabledsetting through a cascading project setting attribute - This triggered a database query that attempted to use an integer value that exceeded PostgreSQL's integer range limits
- The database rejected the query with "integer out of range" error
- This caused the entire database transaction to be aborted, leading to subsequent "current transaction is aborted, commands ignored until end of transaction block" errors
- The seeding process failed, causing the
gdk installcommand to fail, which ultimately caused the entire job to fail
The specific error chain shows the failure originated in the cascaded_ancestor_value method when trying to execute a database query, which then propagated up through the merge request creation service.
Example Fix
The fix would likely involve addressing the integer overflow issue in the database. Here are the most probable solutions:
-
Database Schema Fix: Check if there's a column in the database that's defined as a regular
integertype but is receiving values that exceed the 32-bit integer limit (2,147,483,647). The column may need to be changed tobiginttype:
ALTER TABLE table_name ALTER COLUMN column_name TYPE bigint;
- Data Validation Fix: Add validation in the Ruby code to ensure integer values don't exceed PostgreSQL's limits before attempting database operations:
# Validate integer values before database operations
if value > 2_147_483_647
# Handle the overflow case appropriately
value = 2_147_483_647 # or raise an error, or use a different approach
end
-
Seeding Data Fix: Review the test data being generated in the
10_merge_requests.rbfixture file to ensure it's not creating unrealistic integer values that exceed database limits.
The actual fix would require examining the specific database schema and the data being inserted to identify which column is causing the overflow. The error occurs during the cascading project setting attribute lookup, so it's likely related to project IDs, user IDs, or other numeric identifiers in the project hierarchy.