## TL;DR
Error 6041 is Entra's duplicate detection: the provisioning service found a matching user in the target app and refused to create a second one. Confirm the match is the right person, then link the accounts instead of creating.

```text
"Entra ID provisioning error 6041" user already exists
```

## Use this when
- Entra provisioning logs show error 6041 for a user.
- The user exists in the target app from before Entra managed it.
- The error names a matching attribute like mailNickname.

## Not for this skill when
- The error is 6040 or a different code. Read that code's meaning first.
- The target account belongs to someone else. That is a data cleanup problem.
- The provisioning service cannot reach the target at all. That is connectivity.

## Steps
1. Open the Provisioning logs in Entra for the app and find the 6041 entry. Verify: you have the matching attribute and value.
2. Search the target app for the existing account using that value. Verify: exactly one account matches.
3. Confirm it is the same person as the Entra user. Verify: a second identifier agrees.
4. Adjust the matching attribute so Entra links on the next sync, or link manually in the app. Verify: the link is recorded.
5. Restart provisioning for that user. Verify: the user links cleanly with no 6041.

## Variant phrasings
### Azure AD error 6041
The legacy product-name phrasing.
### Entra provisioning duplicate
The symptom-first search.
### "user already exists in target"
The message-first phrasing.

Compatibility: Microsoft Entra ID automatic provisioning (SCIM), any target app.

## Why it happens
Entra matches existing target accounts on its configured matching attributes before creating. When it finds a match, it reports 6041 rather than risk a duplicate. The intended resolution is linking, not forcing a create.

## Edge cases / pitfalls
- Matching on the wrong attribute can link the wrong person; verify with a second identifier.
- Soft-deleted target accounts still match on some apps; purge or restore them.
- The matching attribute changing later breaks the link; keep it stable.
- Multiple matches (two target accounts) need manual cleanup before linking.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_1AxgSZZ0zybUy6-mHc_ICA
