Knowledge base / API keys

Fix InvalidKeyMapError on Google Maps

Google rejected the key string itself. In practice the key is usually fine and something in the page mangled it.

How to tell this is your problem

  • InvalidKeyMapError on every load.
  • The key works when pasted into a plain test page.
  • The map broke after a theme, plugin or CMS update.

Why it happens

Trailing spaces, HTML-escaped characters, a truncated paste, or a key deleted in Cloud Console all produce the same error.

The fix, step by step

  1. 01View source and read the key exactly as it appears in the script URL.
  2. 02Compare it character-for-character with the key in Cloud Console.
  3. 03Re-paste it into your CMS field with no surrounding whitespace and save.
  4. 04If the key no longer exists in Cloud Console, create a new one and apply the same restrictions.

Confirm it is fixed

The console error clears on the next load; scan the page to confirm no other key is being injected elsewhere.

Check whether this is your error

A scan tells you in about twelve seconds, from a clean session.

Related articles