ERROR: nextval: reached maximum value of sequence "logs_id_seq" in Red Hat Satellite 6
Environment
- Red Hat Satellite
- 6.15
- 6.16
- 6.17
Issue
-
The Ansible callback that is uploading data to Satellite is getting error
500. -
Some services using Satellite API fail with
500errors, most of them starting with the following text:2025-09-25T15:49:24 [W|app|afca0a76] Action failed 2025-09-25T15:49:24 [I|app|afca0a76] Backtrace for 'Action failed' error (ActiveRecord::StatementInvalid): PG::SequenceGeneratorLimitExceeded: ERROR: nextval: reached maximum value of sequence "logs_id_seq" (2147483647)
Resolution
-
This issue has been reported to the Red Hat Satellite Engineering team via This content is not included.SAT-38813 bug and is being actively investigated.
-
To fix the issue manually on the affected Red Hat Satellite server, proceed with the following steps:
-
Ensure that a backup or VM snapshot exists for the affected Red Hat Satellite server, before proceeding further.
-
Clear any paused tasks that might be present.
# foreman-rake foreman_tasks:cleanup TASK_SEARCH='label ~ *' STATES='paused' VERBOSE=true -
Check the
max_valueandlast_valueoflogs_id_seqsequence in foreman database. They are expected to be the same at this point.# echo "select * from pg_sequences where sequencename='logs_id_seq';" | su - postgres -c "psql -x foreman" -
Fix the issue:
# echo "ALTER SEQUENCE logs_id_seq AS bigint;" | su - postgres -c "psql foreman" -
Verify that
max_valueis now much higher thanlast_valueforlogs_id_seqsequence and itsdata_typeis set asbigint# echo "select * from pg_sequences where sequencename='logs_id_seq';" | su - postgres -c "psql -x foreman" -
Restart the services.
# satellite-maintain service restart # sleep 20 & hammer ping
-
-
Reach out to Red Hat Technical Support in case of any further questions or concerns.
For more KB articles/solutions related to Red Hat Satellite 6.x PostgreSQL-related Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x PostgreSQL-related Issues
Root Cause
- As it can be observed in the Diagnostic Steps section,
- The
idcolumn ofpublic.logstable is ofintegerdata type and depends onlogs_id_seq. - The
logs_id_seqitself also has the data type set tointegerdue to which the value of themax_valuefield is limited to2147483647and thelast_valuefield has reached that specific limit.
- The
Diagnostic Steps
-
The following traceback recurs a lot in
/var/log/foreman/production.log:2025-09-25T15:49:24 [W|app|afca0a76] Action failed 2025-09-25T15:49:24 [I|app|afca0a76] Backtrace for 'Action failed' error (ActiveRecord::StatementInvalid): PG::SequenceGeneratorLimitExceeded: ERROR: nextval: reached maximum value of sequence "logs_id_seq" (2147483647) -
Inspecting the sequence and table in concern, the following can be found in the foreman database.
# echo "select * from pg_sequences where sequencename='logs_id_seq';" | su - postgres -c "psql -x foreman" -[ RECORD 1 ]-+------------ schemaname | public sequencename | logs_id_seq sequenceowner | foreman data_type | integer start_value | 1 min_value | 1 max_value | 2147483647 ------------------> Not large enough value increment_by | 1 cycle | f cache_size | 1 last_value | 2147483647 ------------------> same as max_value which means it had reached its limit- It's not expected
data_typefor the id field or the sequence to beintegeras the table can hold a lot of records and should have a large enoughmax_value(and that can be achieved frombigintdata type).
- It's not expected
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.