Error adding a field to a table - Duplicate entry '-1' for key 'PRIMARY'

Peter Bishop
Kilo Expert

I'm trying to add a field to an existing table and I'm getting the error:

INSERT INTO sys_metadata

...

java.sql.BatchUpdateException: Duplicate entry '-1' for key 'PRIMARY'

The full error indicates that the value '-1' is being inserted (or trying) into the 'sys_id' field and this is breaching the primary key. From what I've read, the '-1' value is supposed to cause a new value to be assigned but that's clearly not happening in this case.

Can anyone advise what's occurring and, more importantly, how to fix it?

2 REPLIES 2

Geetanjali Khy2
Mega Guru

Hello Peter,

Please check below link it may help you out.

https://community.servicenow.com/community?id=community_question&sys_id=d63e87eddb9cdbc01dcaf3231f96...

 

Regards,

Geetanjali Khyale

Thanks but nothing in there managed to help.