Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Next.js and React

CKEditor 5 turns read-only and logs an invalid license key code

Your error

template-invalid-license-key3 more lines it can show

Fix it fast

Most common cause, 1 of 4

The 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.

Fix
public config = {
  licenseKey: '<YOUR_LICENSE_KEY>',
  plugins: [ Essentials, Paragraph, Bold, Italic ],
  toolbar: [ 'undo', 'redo', '|', 'bold', 'italic' ]
};
Did this fix it?
Full steps for this cause: check, fix, verify

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.

  • Applies to CKEditor 5 v49.1.0 (ckeditor5 and ckeditor5-premium-features), @ckeditor/ckeditor5-angular 13.0.0, Angular 21.2 to 22.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

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.

Run this first
grep -rn "licenseKey" src/
npm ls ckeditor5 ckeditor5-premium-features

Then find the line you see in this list and open its fix:

  1. 1The key string is damaged or came from the wrong part of the portalThe console shows plain invalid-license-key, with no plugin name in front of it
  2. 2'GPL' or a smaller plan is used with a premium plugin such as TemplateThe code carries a plugin prefix (template-, format-painter-, pagination-) or reads license-key-plugin-not-allowed, and ckeditor5-premium-features is in npm ls
  3. 3The trial ran out, or the editor is newer than the keyThe console shows license-key-expired, often right after an npm update or 14 days after signing up
  4. 4A development key or approved-hosts list does not include this domainlicense-key-domain-limit appears on staging or production while the same key works on localhost

What does the error look like?

  • template-invalid-license-key
  • invalid-license-key Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-invalid-license-key
  • license-key-expired
  • license-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.

Check
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.

Fix
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.

Verify
ng serve

Confirmed by ckeditor.com

Did this fix it?

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.

Check
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.

Fix
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.

Verify
npm ls ckeditor5-premium-features

Confirmed by ckeditor.com

Did this fix it?

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.

Check
npm ls ckeditor5

Fix

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.

Fix
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.

Verify
ng build

Confirmed by raw.githubusercontent.com

Did this fix it?

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.

Check
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.

Fix
public config = {
  licenseKey: '<PRODUCTION_KEY_WITH_THIS_DOMAIN>',
  plugins: [ /* ... */ ]
};

Verify

Open the deployed site. No domain code appears and the development banner is gone.

Verify
ng build --configuration production

Confirmed by ckeditor.com

Did this fix it?

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.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.