SeleniumHQ/selenium · critical · Error

Error executing command for ${smBinary} with ${args}: ${e.to

Error message

Error executing command for ${smBinary} with ${args}: ${e.toString()}

What it means

Thrown by binaryPaths() when selenium-manager exits with status 0 (success) but its stdout cannot be parsed as JSON. The wrapper expects a JSON object containing result.driver_path and result.browser_path. A JSON.parse failure triggers this with the parse error stringified and set as `cause`.

Source

Thrown at javascript/selenium-webdriver/common/seleniumManager.js:93

    let errorMessage
    if (spawnResult.stderr.toString()) {
      errorMessage = spawnResult.stderr.toString()
    }
    if (spawnResult.stdout.toString()) {
      try {
        output = JSON.parse(spawnResult.stdout.toString())
        logOutput(output)
        errorMessage = output.result.message
      } catch (e) {
        errorMessage = e.toString()
      }
    }
    throw new Error(`Error executing command for ${smBinary} with ${args}: ${errorMessage}`)
  }
  try {
    output = JSON.parse(spawnResult.stdout.toString())
  } catch (e) {
    throw new Error(`Error executing command for ${smBinary} with ${args}: ${e.toString()}`, { cause: e })
  }

  logOutput(output)
  return {
    driverPath: output.result.driver_path,
    browserPath: output.result.browser_path,
  }
}

function logOutput(output) {
  for (const key in output.logs) {
    if (output.logs[key].level === 'WARN') {
      log_.warning(`${output.logs[key].message}`)
    }
    if (['DEBUG', 'INFO'].includes(output.logs[key].level)) {
      log_.debug(`${output.logs[key].message}`)
    }
  }

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Unset SE_MANAGER_PATH to use the bundled binary, or point it to the exact version bundled with this package.
  2. Remove any shell wrapper or alias that wraps the selenium-manager binary.
  3. Reinstall/upgrade selenium-webdriver so the binary and JS bindings match.
  4. Check for antivirus or monitoring tools that inject into child process stdout.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const result = binaryPaths(args)
} catch (e) {
  if (e.cause && e.cause instanceof SyntaxError) {
    console.error('Selenium Manager output was not JSON. Check SE_MANAGER_PATH and binary version.')
  }
  throw e
}

Prevention

When it happens

Trigger: SE_MANAGER_PATH points to an older/custom selenium-manager that outputs plain text; a shell wrapper or alias injects non-JSON text into stdout; antivirus or logging middleware corrupts stdout; version mismatch between the JS bindings and the binary.

Common situations: Pointing SE_MANAGER_PATH to a system selenium-manager of a different version; a corporate wrapper script around the binary that prints banners; mismatched selenium-webdriver package and binary versions after a partial upgrade.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/6c925068cec418d6. Report an issue: GitHub.