cypress-io/cypress · error · Error

Unknown component name "${componentName}"

Error message

Unknown component name "${componentName}"

What it means

Raised by reportComponentVersion() during `cypress version --component <name>` when the supplied component name is not one of the four known keys: 'package', 'binary', 'electron', or 'node'. The commander option is declared as `--component <package|binary|electron|node>`, so this fires when a user passes a value outside that enumerated set (commander does not enforce the placeholder enum).

Source

Thrown at cli/lib/cli.ts:198

  debug('parsed version arguments %o', opts)

  const reportAllVersions = (versions: any): void => {
    logger.always('Cypress package version:', versions.package)
    logger.always('Cypress binary version:', versions.binary)
    logger.always('Electron version:', versions.electronVersion)
    logger.always('Bundled Node version:', versions.electronNodeVersion)
  }

  const reportComponentVersion = (componentName: string, versions: any): void => {
    const names: any = {
      package: 'package',
      binary: 'binary',
      electron: 'electronVersion',
      node: 'electronNodeVersion',
    }

    if (!names[componentName]) {
      throw new Error(`Unknown component name "${componentName}"`)
    }

    const name = names[componentName]

    if (!versions[name]) {
      throw new Error(`Cannot find version for component "${componentName}" under property "${name}"`)
    }

    const version = versions[name]

    logger.always(version)
  }

  const defaultVersions = {
    package: undefined,
    binary: undefined,
    electronVersion: undefined,
    electronNodeVersion: undefined,

View on GitHub (pinned to 0d85fdc912)

Solutions

  1. Use one of the exact values: cypress version --component package | binary | electron | node.
  2. Check spelling and case — the match is exact and case-sensitive.
  3. Run `cypress version` with no --component to print all four versions at once.

Example fix

# before: cypress version --component Electron
# after: cypress version --component electron
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['package', 'binary', 'electron', 'node'])

function assertComponent(name: string) {
  if (!KNOWN.has(name)) {
    throw new Error(`--component must be one of: ${[...KNOWN].join(', ')}`)
  }
}

Type guard

function isKnownComponent(c: string): c is 'package' | 'binary' | 'electron' | 'node' {
  return c === 'package' || c === 'binary' || c === 'electron' || c === 'node'
}

Prevention

When it happens

Trigger: Running `cypress version --component foo`, `cypress version --component Electron` (wrong case), `cypress --component binaries`, or any other value not exactly matching package/binary/electron/node.

Common situations: Typing the component name; using wrong case (Electron vs electron); passing a plural (binaries); an older script assuming a different component name.

Related errors


AI-assisted analysis of cypress-io/cypress@0d85fdc912 (2026-08-12). Data as JSON: /api/errors/b4de2e88268703f1. Report an issue: GitHub.