agalwood/Motrix · error · Error

invalid Chrome extension ID: ${id}

Error message

invalid Chrome extension ID: ${id}

What it means

Thrown by validateId() inside TrustedExtensionRegistry when a Chromium extension ID fails the regex /^[a-p]{32}$/ (exactly 32 lowercase characters in the range a-p, which is the base-16-p letters encoding Chrome uses for extension IDs). Reached via registry.add() for user-added/imported entries, and also during load() where invalid entries are silently skipped. This is a plain Error (no error code), thrown before the entry is persisted.

Source

Thrown at src/core/bridge/trusted-extension-registry.ts:24

  id: string
  browser: Browser
  source: TrustSource
  label?: string
  addedAt: number
}

export interface RegistryStore {
  read(): Promise<string | null>
  write(content: string): Promise<void>
}

const CHROME_ID_RE = /^[a-p]{32}$/
const FIREFOX_ID_RE = /^([^@\s]+@[^@\s]+|\{[0-9a-fA-F-]{36}\})$/

function validateId(id: string, browser: Browser): void {
  if (browser === 'chromium') {
    if (!CHROME_ID_RE.test(id)) {
      throw new Error(`invalid Chrome extension ID: ${id}`)
    }
  } else {
    if (!FIREFOX_ID_RE.test(id)) {
      throw new Error(`invalid Firefox extension ID: ${id}`)
    }
  }
}

export class TrustedExtensionRegistry {
  private entries = new Map<string, TrustedExtension>()
  private builtinIds = new Set<string>()

  constructor(
    private store: RegistryStore,
    private builtin: Array<{ id: string; browser: Browser }>
  ) {}

  async load(): Promise<void> {

View on GitHub (pinned to 1a708ee577)

Solutions

  1. Verify the Chrome extension ID is exactly 32 lowercase characters from a-p (find it in chrome://extensions or the Web Store URL)
  2. Strip whitespace and normalize case before calling add()
  3. If the ID is actually a Firefox extension, pass browser: 'firefox' instead of 'chromium'
  4. Validate with the same regex before calling add() to give a better error message to the user

Example fix

// before
await registry.add('abcdefghijklmnopqrstuvwx', 'chromium', 'user-added')
// after
await registry.add('abcdefghijklmnopqrstuvwxyz012345', 'chromium', 'user-added') // 32 chars a-p
Defensive patterns

Strategy: validation

Validate before calling

const CHROME_ID_RE = /^[a-p]{32}$/
function isValidChromeId(id: string): boolean {
  return CHROME_ID_RE.test(id)
}
// Before add:
if (!isValidChromeId(id)) {
  throw new Error(`Invalid Chrome extension ID (need 32 chars a-p): ${id}`)
}

Type guard

function isChromeExtensionId(id: string): boolean {
  return /^[a-p]{32}$/.test(id)
}

Try / catch

try {
  await registry.add(id, 'chromium', 'user-added', label)
} catch (e) {
  if (e instanceof Error && e.message.startsWith('invalid Chrome extension ID')) {
    showUserError('Enter a valid Chrome extension ID (32 characters, a-p only)')
  } else throw e
}

Prevention

When it happens

Trigger: TrustedExtensionRegistry.add(id, 'chromium', source, label?) is called with an id that is not exactly 32 characters of [a-p]: wrong length, uppercase letters, characters outside a-p, or empty string.

Common situations: A user manually enters an extension ID with a typo; an imported registry file contains a corrupted/malformed Chrome ID; confusing a Chrome extension ID (32 chars a-p) with a Firefox ID (email or UUID format); copying an ID with extra whitespace or hyphens.

Related errors


AI-assisted analysis of agalwood/Motrix@1a708ee577 (2026-08-12). Data as JSON: /api/errors/86840e03190f90a5. Report an issue: GitHub.