Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Profile Manager duplicate key value violates unique constraint

Hi,


I have a big problem with my Profile Manager (Server 5.10, Catalina).

To the log I have (repeat x time each second...) :


0:: [303] [2022/01/20 14:17:50.209]  Caught exception sending objc_msgsend-style notification <PGDatabaseNotification:0x7f8136a92930> [channel: 'objc_send', message: '[LibraryItemMetadata parseAvailableOSUpdatesForLibraryItemMetadataID:72899]'].
    -[PGConnection executeSQL:withParams:] (PGConnection.m:628): "Postgres error 23505 (ERROR:  duplicate key value violates unique constraint "os_updates_devices_device_id_os_update_id_key"
    DETAIL:  Key (device_id, os_update_id)=(72899, 9064494) already exists.
    )"
1:: [303] [2022/01/20 14:17:50.210] EXCEPTION:  !IF <-[PGConnection beginTransactionWithID:priority:perform:] (PGConnection.m:350): "'((_transactionAborted))'">
0:: [303] [2022/01/20 14:17:50.210] Caught unhandled exception -[PGConnection beginTransactionWithID:priority:perform:] (PGConnection.m:350): "'((_transactionAborted))'"
0:: [303] [2022/01/20 14:17:50.210] Caught exception processing queued DB notification: -[PGConnection beginTransactionWithID:priority:perform:] (PGConnection.m:350): "'((_transactionAborted))'"
1:: [303] [2022/01/20 14:17:50.211] INVOKING [LibraryItemMetadata parseAvailableOSUpdatesForLibraryItemMetadataID: {"72899"}]
0:: [303] [2022/01/20 14:17:50.218] EXCEPTION:  Postgres <-[PGConnection executeSQL:withParams:] (PGConnection.m:628): "Postgres error 23505 (ERROR:  duplicate key value violates unique constraint "os_updates_devices_device_id_os_update_id_key"
    DETAIL:  Key (device_id, os_update_id)=(72899, 9064495) already exists.
    )">
    USERINFO: {
        SQLSTATE = 23505;
        errorMessage = "ERROR:  duplicate key value violates unique constraint \"os_updates_devices_device_id_os_update_id_key\"\nDETAIL:  Key (device_id, os_update_id)=(72899, 9064495) already exists.\n";
    }


I don't understand why. Ref for device_id is 72899. Where I can find device_id in my Profile Manager?

The message like logs files.... :

Posted on Jan 20, 2022 5:35 AM

Reply
Question marked as Best reply

Posted on Jan 20, 2022 8:46 AM

Find solution :


Find the device, backup database :

sudo -u _devicemgr /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr devicemgr_v2m0 -c -f /tmp/device_manageme.sql



Open the backup file and find the device_id (look to the logs) to see the name of device.

Remove it from the MDM.

Similar questions

3 replies
Question marked as Best reply

Jan 20, 2022 8:46 AM in response to Graphiz

Find solution :


Find the device, backup database :

sudo -u _devicemgr /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h /Library/Server/ProfileManager/Config/var/PostgreSQL -U _devicemgr devicemgr_v2m0 -c -f /tmp/device_manageme.sql



Open the backup file and find the device_id (look to the logs) to see the name of device.

Remove it from the MDM.

Profile Manager duplicate key value violates unique constraint

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.