Not Able to Create Watchlist Due to watchlist_id Out Of Sync
search cancel

Not Able to Create Watchlist Due to watchlist_id Out Of Sync

book

Article ID: 292557

calendar_today

Updated On:

Products

Carbon Black EDR (formerly Cb Response)

Issue/Introduction

  • Receiving the following error when creating watchlist on the console:
"An error occurred in creating watchlist <name>"
  • The coreservices log shows error
"2019-02-01 02:48:09 [19774] <err> cb.flask.blueprint_helpers - Unhandled exception from API request: (psycopg2.IntegrityError) duplicate key value violates unique constraint "watchlist_entries_pkey" 
DETAIL: Key (id)=(1002) already exists.

Environment

  • EDR Server: All versions

Cause

Watchlist ID sequential number is out of sync. 

Resolution

1. Check what is the max ID in watchlist_entries table:

psql -d cb -p 5002 -c "select MAX(*) from watchlist_entries;"

2. Check what is the current sequential number:

psql -d cb -p 5002 -c "select * from watchlist_entries_id_seq;"

3. If they are out of sync, run

psql -d cb -p 5002 -c "alter sequence watchlist_entries_id_seq restart with <max number in watchlist ID>;"