CKEditor 5 turns read-only and logs an invalid license key code
Fix it fast
Most common cause, 1 of 4The key string is damaged or came from the wrong part of the portal
Copy the key again from the License keys tab, paste it as one unbroken string and rebuild the app.
public config = {
licenseKey: '<YOUR_LICENSE_KEY>',
plugins: [ Essentials, Paragraph, Bold, Italic ],
toolbar: [ 'undo', 'redo', '|', 'bold', 'italic' ]
};Short answer
CKEditor 5 printed invalid-license-key, or a plugin code such as template-invalid-license-key, because it rejected config.licenseKey. Usually the key was copied incompletely, 'GPL' is paired with a premium plugin, or a trial or development key does not fit the site. Copy the key again from the Customer Portal and match plugins to your plan. Applies to CKEditor 5 v49.
Which cause do you have?
Open the browser console and copy the exact code after the editor loads. Then see which key string the component passes and whether any premium package is installed. The code name points to the cause: invalid-license-key is cause 1, a plugin name in front of the code or a distribution-channel code is cause 2, expired is cause 3, and a domain code is cause 4.
grep -rn "licenseKey" src/
npm ls ckeditor5 ckeditor5-premium-featuresThen find the line you see in this list and open its fix:
- 1The key string is damaged or came from the wrong part of the portal
The console shows plain invalid-license-key, with no plugin name in front of it - 2'GPL' or a smaller plan is used with a premium plugin such as Template
The code carries a plugin prefix (template-, format-painter-, pagination-) or reads license-key-plugin-not-allowed, and ckeditor5-premium-features is in npm ls - 3The trial ran out, or the editor is newer than the key
The console shows license-key-expired, often right after an npm update or 14 days after signing up - 4A development key or approved-hosts list does not include this domain
license-key-domain-limit appears on staging or production while the same key works on localhost
What does the error look like?
template-invalid-license-keyinvalid-license-key Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-invalid-license-keylicense-key-expiredlicense-key-domain-limit
Cause 1 of 4
The key string is damaged or came from the wrong part of the portal
You seeThe console shows plain invalid-license-key, with no plugin name in front of it
Check
CKEditor 5 shows invalid-license-key when the string in config.licenseKey cannot be decoded or its built-in checksum does not match. A key that lost its last characters, gained a space or a line break, or was taken from Cloud environments (which hold credentials for services such as document converters) fails that test. Keys for standalone features are listed under License keys in the Customer Portal.
grep -rn -A1 "licenseKey" src/app/Fix
Copy the key again from the License keys tab, paste it as one unbroken string and rebuild the app.
public config = {
licenseKey: '<YOUR_LICENSE_KEY>',
plugins: [ Essentials, Paragraph, Bold, Italic ],
toolbar: [ 'undo', 'redo', '|', 'bold', 'italic' ]
};Verify
Reload the page. The editor accepts typing and the console no longer lists a license code.
ng serveConfirmed by ckeditor.com
Cause 2 of 4
'GPL' or a smaller plan is used with a premium plugin such as Template
You seeThe code carries a plugin prefix (template-, format-painter-, pagination-) or reads license-key-plugin-not-allowed, and ckeditor5-premium-features is in npm ls
Check
A plugin-prefixed code such as template-invalid-license-key means a premium feature found no licence that covers it. The 'GPL' value only unlocks the open-source plugins, and only for npm or ZIP installs; on the CDN it raises license-key-invalid-distribution-channel instead. A commercial key whose plan lacks the feature gives license-key-plugin-not-allowed.
grep -rn "ckeditor5-premium-features" src/Fix
Pick one path. Either drop the premium plugin from plugins and toolbar and keep 'GPL', or start the 14-day trial or a paid plan and paste that key while keeping Template.
import { ClassicEditor, Essentials, Paragraph, Bold, Italic } from 'ckeditor5';
public config = {
licenseKey: 'GPL',
plugins: [ Essentials, Paragraph, Bold, Italic ],
toolbar: [ 'undo', 'redo', '|', 'bold', 'italic' ]
};Verify
With GPL, the toolbar shows only open-source buttons and the Powered by CKEditor logo. With a trial or paid key, the insertTemplate toolbar item works without a console error.
npm ls ckeditor5-premium-featuresConfirmed by ckeditor.com
Cause 3 of 4
The trial ran out, or the editor is newer than the key
You seeThe console shows license-key-expired, often right after an npm update or 14 days after signing up
Check
license-key-expired has two triggers in the editor source. A trial or evaluation key fails once its end date passes. Any key also fails when its end date is earlier than the release date of the installed ckeditor5 build, so updating the package after a subscription lapsed can cause it.
npm ls ckeditor5Fix
Renew the plan in the Customer Portal and paste the new key. If you left the trial and only need open-source features, switch the value to 'GPL' and remove the premium plugins as in cause 2.
public config = {
licenseKey: '<NEW_KEY_FROM_CUSTOMER_PORTAL>',
plugins: [ /* same plugins as before */ ]
};Verify
The editor starts editable after a hard reload, and no expiry code is printed.
ng buildConfirmed by raw.githubusercontent.com
Cause 4 of 4
A development key or approved-hosts list does not include this domain
You seelicense-key-domain-limit appears on staging or production while the same key works on localhost
Check
license-key-domain-limit is raised when the page's hostname is not in the hosts the key allows. On usage-based plans a development key runs only on localhost, *.test, *.localhost, *.local, 127.0.0.1, 192.168.*.*, 10.*.*.* and 172.*.*.*. A production key with the optional approved hosts list accepts only the up to five domains saved there.
grep -rln "licenseKey" src/Fix
Use the production key on public domains. If approved hosts is switched on, add the domain in the License keys tab, then paste the key the portal creates after that change.
public config = {
licenseKey: '<PRODUCTION_KEY_WITH_THIS_DOMAIN>',
plugins: [ /* ... */ ]
};Verify
Open the deployed site. No domain code appears and the development banner is gone.
ng build --configuration productionConfirmed by ckeditor.com
How do I stop it coming back?
- Keep the development key and the production key in separate build configurations, so a localhost key never ships with ng build --configuration production.
- Pin ckeditor5 and ckeditor5-premium-features to the same exact version, and check the key's end date before raising that version.
- List the premium plugins your plan covers next to the editor config, so a new toolbar button is checked against the plan first.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.