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
- Use one of the exact values: cypress version --component package | binary | electron | node.
- Check spelling and case — the match is exact and case-sensitive.
- 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
- Restrict --component to the four enumerated values before invoking the CLI.
- Remember the value is case-sensitive.
- Prefer `cypress version` (no flag) when you want all versions.
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
- Cannot find version for component "${componentName}" under p
- Invalid project path parameter: ${options.project}
- No file name specified. This is required to generate a new C
- Invalid grep burn value: ${grepBurn}
- ESM plugin config value '${name}' must be an array of string
AI-assisted analysis of cypress-io/cypress@0d85fdc912 (2026-08-12).
Data as JSON: /api/errors/b4de2e88268703f1.
Report an issue: GitHub.