Cart0

Windows · fix · 6 min read

0xC004F012 Activation Error: How to Fix It on Windows 10 and 11

Published

Short answer: The 0xC004F012 activation error shows that the Software Licensing Service couldn't find a value in the local license store. Usually the tokens.dat file got damaged. An upgrade or a crash is the typical trigger. I'd rebuild that file, reinstall the license files and restart twice. Then reinstall your product key.

The 0xC004F012 activation error appears when the Software Licensing Service can’t find a value in the Windows license store. Activation stops before it reaches your key.

In most cases the license store file, tokens.dat, is damaged or incomplete.

  • Rebuild tokens.dat with Microsoft’s documented commands.
  • Restart twice.
  • Reinstall your product key and activate again.

The full text reads: “The Software Licensing Service reported that the call failed because the value for the input key was not found.”

It’s not the clearest sentence Microsoft ever wrote. The “input key” here isn’t your product key.

It’s an internal lookup key inside the licensing database. Say the code appears on a remote worker’s laptop after a big feature update.

Then the problem usually sits in a file on the disk, and the license is fine.

Point Detail
What the code says The licensing service could not find a value it needed in the local license store. A local problem, not a rejected key
Documented fix Rebuild tokens.dat in %windir%\System32\spp\store\2.0 and run slmgr /rilc, then restart twice
Afterwards Reinstall your key with slmgr /ipk. Microsoft warns never to use /upk for that
Typical triggers A feature update or in-place upgrade, an interrupted install, disk errors, or cleanup and “activation” tools that touched the store
If the rebuild does not help Repair system files with sfc /scannow and DISM /Online /Cleanup-Image /RestoreHealth

What 0xC004F012 stands for

In plain terms, Windows looked up a licensing entry in its local store, and the entry was missing.

Activation can’t continue without it. So the code shows up even with a valid key.

Microsoft’s consumer list of activation codes doesn’t include this one, and neither does the main IT reference table. That’s why many pages guess.

The message text and Microsoft’s own “rebuild the licensing store” article tell a consistent story. The license store on your PC is the suspect.

You can see the official wording on your own machine. Press Win+R and run this:

slui.exe 0x2a 0xC004F012

Windows opens the activation dialog with that code’s description. The trick works for any activation code, which is handy when a screenshot shows only the number.

Causes

A damaged or incomplete license store causes it most often. That often follows a feature update, an in-place upgrade or a reset that didn’t finish.

Cause Clue Fix
Corrupt or incomplete tokens.dat The code appears after an upgrade, update or crash Rebuild tokens.dat, slmgr /rilc, restart twice
Corrupted system files Other odd faults, failed updates sfc /scannow, then DISM RestoreHealth
Software Protection service stopped or broken sc query sppsvc fails, or the service will not start Start the service, then repair system files
Licensing files modified by third-party tools An “activator” or cleanup utility was used before Rebuild the store, reinstall a genuine key; in-place repair if needed
Disk errors Event Viewer shows disk or NTFS warnings chkdsk /scan, back up data, then rebuild
No valid key after the rebuild The rebuild works, then a different code appears Enter your own key or buy a license

A quick word on unofficial activators. They often work by replacing or editing exactly the files this code is about.

Remove them, rebuild the store and use a genuine key. Otherwise the code tends to come back after the next update.

How to fix the 0xC004F012 activation error

A rebuild of the license store fixes it, and the whole procedure takes about ten minutes.

  1. Write down your product key first. Or confirm on the Activation page that a digital license is linked to your Microsoft account.
  2. Open Command Prompt as administrator: search for cmd, right-click Command Prompt and select Run as administrator.
  3. Stop the Software Protection service with the first line below.
  4. Go to the license store folder with the second line.
  5. Rename the store file with the third line. Renaming keeps a backup, so don’t delete the file.
  6. Start the service again with the fourth line.
  7. Reinstall the system license files with the fifth line.
  8. Restart the computer twice. The second restart matters, and Microsoft’s procedure asks for both.
  9. Reinstall your key and activate, with the sixth and seventh lines.
  10. Check the result with the last line. “License Status: Licensed” shows you’re done.
net stop sppsvc
cd %windir%\System32\spp\store\2.0
ren tokens.dat tokens.bar
net start sppsvc
cscript.exe %windir%\System32\slmgr.vbs /rilc
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /ato
slmgr /dlv

After the rebuild Windows needs the key again. With a digital license and no key, open the Activation page and select Troubleshoot.

The steps follow Microsoft’s procedure for how to rebuild the Tokens.dat file, originally KB 2736303.

The same article warns never to use the /upk switch to remove a key. Install the fresh one over the old with /ipk.

If the stop line reports that the service isn’t running, carry on with the next step. If the rename says access is denied, the service is still running. I’d run the stop line once more and wait a few seconds.

If the rebuild doesn’t help

Repair the Windows system files next, then restart and rebuild the store once more.

When both fail, an in-place repair install keeps your apps and files and replaces the licensing components.

Work in this order, as a rule.

Step Line What it does
SFC sfc /scannow Checks protected system files against the local copy, from an admin prompt
DISM DISM /Online /Cleanup-Image /RestoreHealth Repairs the local copy itself from Windows Update. Run SFC again afterwards if DISM found something
Disk check chkdsk C: /scan Reports file system errors without taking the drive offline. Repeated errors suggest a failing drive, so back up first
In-place repair setup.exe from Windows 11 installation media, run inside Windows Choose to keep files and apps. Usually a last resort, but effective when the licensing stack is badly broken

A full reset sometimes helps too. It costs far more hours than a repair install and gives no better odds for this particular code.

Is the product key bad

No. The code is raised before Microsoft ever checks your key. So it says nothing about the key’s validity.

It points to the local license store. Once the store is rebuilt, a genuine key activates normally.

If a different code appears afterwards, that code tells you about the key.

Code after the rebuild What it tells you
0xC004C003 The key was blocked
0xC004F213 No key was found for this hardware (see the 0xC004F213 guide)
0x803F7001 No valid license exists for the device (see the 0x803F7001 guide)
0x87E10BC6 A server-side code; the 0x87E10BC6 guide explains that one

Each has its own fix.

Need a key? Our Windows 11 Pro key comes as a genuine license. We email it instantly after payment.

After a Windows upgrade

That’s one of the most common moments to see this code. The license store can end up half-migrated.

Typical triggers
A feature update, such as 24H2 to 25H2
An in-place upgrade from Windows 10 to Windows 11
A reset interrupted by a power cut

Rebuilding tokens.dat is usually enough, and a digital license then reactivates by itself.

Before you rebuild, give Windows one chance. Restart, connect to the internet, wait twenty minutes and check the Activation page again.

Background activation sometimes fixes a fresh upgrade with no help. If the code is still there, rebuild.

According to Microsoft, a move between the two systems on the same hardware keeps your license. The edition has to stay the same.

A Home license upgrades to Home, and Pro to Pro. A mismatch there produces other codes, not this one.

Windows Server and Office

On current server versions the fix is identical. The rebuild procedure is written for Windows Server and modern Windows alike, with the same folder path.

On a server, plan the two restarts in a maintenance window. After the rebuild, reinstall the server key and activate.

Server Key to reinstall
KMS-activated A KMS client setup key
Any other Your MAK or retail key

Volume-licensed Office on a client PC shares the same Software Protection service. So expect to reactivate Office after a rebuild.

For the LTSC volume editions, check the license afterwards from the program folder.

Item Value
Editions Office LTSC 2021 or 2024 volume editions
Folder, typically C:\Program Files\Microsoft Office\Office16
Check the license cscript ospp.vbs /dstatus
Activate again cscript ospp.vbs /act
If Office still reports a licensing failure Run Online Repair from Settings → Apps → Installed apps → Microsoft Office → Modify

Where these steps apply

System Where to work
Windows 11 Home and Pro (23H2, 24H2, 25H2) Settings → System → Activation; Terminal (Admin) or Command Prompt as administrator
Windows 10 Home, Pro and Enterprise (22H2) Settings → Update & Security → Activation
Windows Server 2016, 2019, 2022 and 2025 Elevated Command Prompt; restarts in a maintenance window

The path of the store file is the same on all of them:

%windir%\System32\spp\store\2.0

Older systems such as Windows 7 and Windows 8 use different paths and aren’t covered here.

For the bigger picture of every common code, see the Windows 11 activation errors overview.

Mistakes we see most

  • Deleting the store file when a rename keeps a backup.
  • Restarting once and skipping the second restart.
  • Forgetting to note the product key before the rebuild.
  • Using the /upk switch to remove a key.
  • Buying a key for a problem in the local store.
  • Leaving an “activator” tool installed.
  • Trying the rename while the service still runs.
  • Resetting Windows before trying a repair install.

Terms used on this page

Term Meaning
License store The local database of licensing data on the PC
tokens.dat The file that holds that store
Software Protection service The service, named sppsvc, that guards the store and handles activation
Software Licensing Service The component that reports this code
Input key An internal lookup key in the licensing database, not your product key
License files reinstall What /rilc does: it puts the system license files back
Digital license An activation Microsoft stores for your hardware
SFC The system file checker
DISM The servicing tool that repairs the system’s own repair source
In-place repair Running setup inside Windows to reinstall it with files and apps kept
KMS client setup key The public key a KMS-activated machine carries

A few cases from support

The feature update

A laptop shows the code after a big feature update. The store file gets rebuilt. After two restarts the digital license activates by itself.

The single restart

Someone rebuilds the store and restarts once. The code stays. After the second restart it’s gone.

The activator

The code returns after every update on one PC. An activator tool keeps editing the licensing files. With the tool removed and a genuine key in, it stays away.

The denied rename

One rename fails with access denied. The service is still running. A second stop command and a short wait fix that.

The office suite

Some office PC has its store rebuilt, and the volume edition of Office asks for activation. One activation command settles it.

FAQ

What does error 0xC004F012 mean?

Windows reports that "the call failed because the value for the input key was not found". An entry was missing from the local license store. The code says nothing about your product key. I'd look for a damaged or incomplete store file on the PC.

Is it safe to rename tokens.dat?

Yes, when you follow Microsoft's procedure. Stop the Software Protection service, rename the file and don't delete it. Then start the service and reinstall the license files. Windows builds a fresh store. I'd note the product key down first, because it has to be reinstalled afterwards.

Where is the tokens.dat file in Windows 11?

It sits in the folder named 2.0, inside the spp store under System32 in the Windows directory. Windows 10 and current servers use the same folder. It's protected while the Software Protection service runs, so I'd stop that service first.

Do I lose my Windows license if I rebuild tokens.dat?

No. The license itself lives in your product key or in Microsoft's records of your digital license. Rebuilding only resets the local store. I'd reinstall the key, or run the Activation troubleshooter for a digital license, and Windows activates again.

Why does 0xC004F012 come back after every update?

Usually something keeps modifying the licensing files. An unofficial activation tool or an aggressive cleanup utility is typical. Damaged system files cause it too. I'd remove those tools, repair the system files, rebuild the store and use a genuine key.

Can I fix 0xC004F012 without the command line?

Partly. The Activation troubleshooter and Change product key in Settings are worth a try. They don't rebuild a damaged license store, though. For the rebuild, I'd open an elevated Command Prompt, where it takes six short commands.