Skip to content

Est. 2011ยทMicrosoft Partner 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

Free Fix Event ID 4

Kerberos Event ID 4 KRB_AP_ERR_MODIFIED: a duplicate SPN in the directory

10 min read Updated October 5, 2026 Windows Server: AD, DNS & Group Policy

Fix it now

The client got a service ticket and the server could not decrypt it. Microsoft’s own text says why: the password used to encrypt the ticket is not the one on the target server, commonly because the service principal name is registered on the wrong account, or because two realms hold identically named machine accounts.

Run these on the machine that logged the event, in an elevated Command Prompt

setspn -Q HTTP/app.contoso.com
setspn -X -F -P
klist purge
klist purge -li 0x3e7
  1. Read the event first. It names the server it was talking to and the target name it asked for – that pair is what you feed to setspn -Q.
  2. setspn -Q <SPN> returns the account that holds the name. Compare it with the account the service actually runs as: if a service runs as a custom account and the name is on the computer account, that is the fault.
  3. Move the registration rather than adding another: setspn -D <SPN> <wrong account>, then setspn -S <SPN> <correct account>. The -S switch checks for duplicates before it adds.
  4. Purge tickets on the client and retry. Tickets are cached, so a correct directory and a stale cache look identical from the user’s chair.

Service principal names must be unique in the forest, and across trusted forests in a multi-forest environment. The exception is a service that uses the computer account and the HOST SPN.

If access works after a purge and retry, you are finished. The next section covers the cases where setspn finds nothing wrong.

Why it happens

A Kerberos service ticket is encrypted with the key of the account that owns the service principal name the client asked for. The client cannot read it; it just hands it over. The server decrypts it with its own key, and if the two accounts are not the same account, the decryption fails and the server returns KRB_AP_ERR_MODIFIED. The client writes Event ID 4, source Kerberos, into its System log, and the user sees access denied.

Microsoft’s published text names two causes in one sentence: the password used to encrypt the ticket differs from the one on the target server, and this is commonly due to identically named machine accounts in the target realm and the client realm. The second half is the one people skip. Two computers called APP01 in two domains produce this error with no duplicate SPN anywhere.

The domain controller has its own view of the same problem. KDC Event ID 11 says the KDC encountered duplicate names while processing a Kerberos authentication request, names the duplicate, and warns that it may cause authentication failures or downgrades to NTLM. That last part explains the intermittent version of this fault: some clients fall back to NTLM and work, others do not, and the difference looks like magic until you read the event.

The service principal name is on the wrong account

You have this one if setspn -Q <SPN> returns a computer account while the service runs as a domain user, or the other way round.

  1. Confirm which account the service actually runs as before deleting anything – the Log On tab of the service, or the application pool identity.
  2. Remove the wrong registration: setspn -D <SPN> <account>.
  3. Add it to the right one: setspn -S <SPN> <account>, then purge tickets and retry.

Microsoft’s own remediation for this event is exactly this sequence: query with -Q, delete with -D, add with -S.

The same name is registered twice

You have this one if setspn -X -F reports a duplicate, or a domain controller logs KDC Event ID 11 naming the SPN.

  1. Search the forest: setspn -X -F -P. Add -T <domain> -T <domain> to include other domains.
  2. Decide which account should keep the name, delete the other registration, and leave a note of what you removed.
  3. Purge tickets on an affected client and confirm the KDC stops logging Event 11.

Two realms hold identically named machine accounts

You have this one if No duplicate SPN anywhere, and the event names a host in one domain while the target name is in another.

  1. Compare the server name in the event with the target name – the event prints both, and they will not match.
  2. Find the second computer object with the same short name in the other domain or forest.
  3. Rename or retire one of them. Aliasing around it with extra SPNs makes the collision worse rather than better.

The service or machine account key has changed under the ticket

You have this one if setspn finds nothing, one server is affected rather than one service, and the machine has recently been restored, cloned or rejoined.

  1. Check the secure channel on that server: nltest /sc_query:<domain>, or Test-ComputerSecureChannel.
  2. Repair in place with Test-ComputerSecureChannel -Repair -Credential * rather than rejoining.
  3. Purge tickets on the clients that were failing, since they still hold tickets encrypted with the old key.

Microsoft also notes a rarer cause: network problems between client and server that truncate the ticket. Treat that as the last explanation, not the first.

Full reference

The codes attached to this failure, and what they are not

Value What Microsoft publishes
0x1F KRB_AP_ERR_BAD_INTEGRITY in the Kerberos failure code table: the integrity check on a decrypted field failed, because the field was encrypted with something other than the expected key
Event 4 The Kerberos client received a KRB_AP_ERR_MODIFIED error from the named server
Event 11 The KDC encountered duplicate names while processing a Kerberos authentication request
8554 ERROR_DS_INVALID_NAME_FOR_SPN: an SPN could not be constructed because the host name is not in the necessary format
8525 ERROR_DS_COULDNT_UPDATE_SPNS: while processing a change to an object’s DNS host name, the SPN values could not be kept in sync

KRB_AP_ERR_MODIFIED is the name in the client’s event text. 0x1F is the value Microsoft’s audit failure-code tables publish as KRB_AP_ERR_BAD_INTEGRITY. They describe the same condition – a field that would not decrypt – but they are separate entries, so do not go looking for “0x1F KRB_AP_ERR_MODIFIED” in the audit tables.

Setspn switches worth knowing

Command What it does
setspn -L <account> Lists the names registered on that account
setspn -Q <SPN> Queries for an existing SPN and returns the account holding it
setspn -X Searches for duplicate SPNs
setspn -F Performs the query at forest level rather than domain level
setspn -T <domain> Runs the query against the named domain, or forest when combined with -F
setspn -P Suppresses progress output, for redirecting to a file
setspn -S <SPN> <account> Adds the name after verifying no duplicate exists. Use this rather than -A
setspn -D <SPN> <account> Deletes the name from that account

Clearing tickets properly

A ticket is cached for its lifetime, so a corrected directory does not take effect until the cache turns over. klist purge clears the current user’s tickets. The computer’s own tickets live in a different logon session, and klist purge -li 0x3e7 clears those – which is the one people forget when the failing identity is a machine account rather than a user. Both are documented switches; the order is purge first, then the logon identifier.

Two neighbouring Kerberos errors that look similar

  • KDC_ERR_S_PRINCIPAL_UNKNOWN: the requested SPN is not associated with any account. That is a missing registration, not a wrong one.
  • KDC_ERR_PRINCIPAL_NOT_UNIQUE: the requested SPN is associated with more than one account. That is the duplicate case, seen from the KDC side.
  • A clock difference produces KRB_AP_ERR_SKEW, not this event. If both the SPN and the account check out, compare the clocks before going further.
  • An encryption type mismatch produces a KDC event about a missing suitable key, and it names the target account rather than reporting a decryption failure on the client.

When the service sits behind a load-balanced name

A shared or virtual name is where duplicate registrations are created deliberately and then forgotten. If several nodes each register the cluster name against their own computer account, every client that reaches a different node than the one that issued the ticket sees this error. The supported pattern is one account owning the shared name – a group managed service account or the cluster identity – with the nodes running the service under it, rather than the same name registered on every node.

Every code this article covers

Code What it points at Source
Event ID 4 The Kerberos client received KRB_AP_ERR_MODIFIED from the named server: the password used to encrypt the service ticket differs from the one on the target server Microsoft Learn
Event ID 11 The KDC encountered duplicate names while processing a Kerberos authentication request; it may cause authentication failures or downgrades to NTLM Microsoft Learn
0x1F KRB_AP_ERR_BAD_INTEGRITY in Microsoft’s Kerberos failure code table: the integrity check on a decrypted field failed. The client event names the same condition KRB_AP_ERR_MODIFIED Microsoft Learn
8554 ERROR_DS_INVALID_NAME_FOR_SPN: a service principal name could not be constructed because the host name supplied is not in the necessary format Microsoft Learn
8525 ERROR_DS_COULDNT_UPDATE_SPNS: while processing a change to an object’s DNS host name, the SPN values could not be kept in sync Microsoft Learn

Confirm the fix worked

  1. setspn -Q <SPN> returns exactly one account, and it is the account the service runs as.
  2. setspn -X -F reports no duplicate for that name.
  3. No new KDC Event ID 11 naming that name on any domain controller.
  4. After klist purge, a client reaches the service without a credential prompt.
  5. No new Kerberos Event ID 4 on the client for that target name.

Questions people ask about this

Does this error mean someone tampered with the ticket?

No. The name is historical. In practice it means the ticket was encrypted with one account’s key and presented to a service running as another.

Can I just add the SPN to the second account as well?

No. A service principal name must be unique in the forest, and across trusted forests where they are involved. Registering it twice is the duplicate case, and it produces authentication failures or silent downgrades to NTLM.

setspn finds no duplicate. What now?

Check for identically named machine accounts in the two realms named in the event, which is the second cause Microsoft’s own text gives, then check the machine account key with nltest /sc_query.

Why do some users work and others do not?

Because a failed Kerberos attempt can fall back to NTLM. The KDC’s duplicate-name event warns about exactly that, which is why the fault looks intermittent.

Do I need to restart the service after fixing the SPN?

Not usually. You do need to clear cached tickets – klist purge for a user session and klist purge -li 0x3e7 for the machine’s own tickets.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

License Error LDAP 8 strong auth required: signing and channel binding enforced on DCs License Error Error 8340: metadata cleanup after a domain controller that never came back License Error Error 8531 Directory Service cannot start: NTDS database and disk failures Free Fix Event ID 4098: Group Policy Preferences items fail to apply on clients
โ† Back to Knowledge Base