agalwood/Motrix · error · Error

invalid Firefox extension ID: ${id}

Error message

invalid Firefox extension ID: ${id}

What it means

Thrown by validateId() inside TrustedExtensionRegistry when a Firefox extension ID fails the regex /^([^@\s]+@[^@\s]+|\{[0-9a-fA-F-]{36}\})$/ — it must be either an email-style ID (name@domain) or a brace-wrapped UUID ({xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}). Plain Error with no code. Reached via registry.add() for user entries.

Source

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

  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> {
    this.entries.clear()
    this.builtinIds.clear()
    for (const b of this.builtin) {
      const e: TrustedExtension = {

View on GitHub (pinned to 1a708ee577)

Solutions

  1. Find the Firefox extension ID in about:addons or the manifest.json 'browser_specific_settings.gecko.id' field
  2. Ensure UUIDs are wrapped in braces: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
  3. If the ID is a Chrome-style 32-char string, pass browser: 'chromium' instead
  4. Validate against the FIREFOX_ID_RE before calling add()

Example fix

// before
await registry.add('my-cool-extension', 'firefox', 'user-added')
// after
await registry.add('cool-extension@example.com', 'firefox', 'user-added')
Defensive patterns

Strategy: validation

Validate before calling

const FIREFOX_ID_RE = /^([^@\s]+@[^@\s]+|\{[0-9a-fA-F-]{36}\})$/
function isValidFirefoxId(id: string): boolean {
  return FIREFOX_ID_RE.test(id)
}
// Before add:
if (!isValidFirefoxId(id)) {
  throw new Error(`Invalid Firefox extension ID (need name@domain or {uuid}): ${id}`)
}

Type guard

function isFirefoxExtensionId(id: string): boolean {
  return /^([^@\s]+@[^@\s]+|\{[0-9a-fA-F-]{36}\})$/.test(id)
}

Try / catch

try {
  await registry.add(id, 'firefox', 'user-added', label)
} catch (e) {
  if (e instanceof Error && e.message.startsWith('invalid Firefox extension ID')) {
    showUserError('Enter a valid Firefox extension ID (name@domain or {uuid})')
  } else throw e
}

Prevention

When it happens

Trigger: TrustedExtensionRegistry.add(id, 'firefox', source) is called with an id that is neither an email-style format nor a braced UUID — e.g. a plain string like 'my-extension', a UUID without braces, or a Chrome-style 32-char ID.

Common situations: User enters a Firefox extension name instead of its ID; copies a UUID without the enclosing braces; passes a Chrome extension ID (32 chars a-p) with browser 'firefox'; types a slug or shortname instead of the add-on's manifest ID.

Related errors


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