Duplicate User Error When Performing a Bulk Import with Upsert False

Overview

When performing a bulk import, duplicate user errors are seen, but the expected number of new users are added.

The error seen is:

{
"code": "DUPLICATED_USER",
"message": "The user already exist and upsert parameter is false"
}

Applies To

  • Bulk User Import
  • Management API

Cause

This error indicates a matching user already exists on the target connection at the point in time the bulk import job attempts to create the user.

This can be caused by a race condition if more than one job is triggered within a short period of time with the same user payload (or subset thereof).

Solution

Ensure when scripting bulk import job creation that only one call is made to the POST /api/v2/jobs/users-imports endpoint for a given payload - two jobs running in quick succession with the same payload can lead to a race condition as to which job creates the user first.

If multiple jobs are being scheduled, check that the user payloads do not contain duplicated user entries as well. If updating existing users is desired, the upsert parameter needs to be set to true.

Related References

Bulk User Imports
Create import users job