{"record":{"id":"5611dd24aa507bba","repo":"SeleniumHQ/selenium","slug":"unsuccessful-command-executed-command","errorCode":null,"errorMessage":"Unsuccessful command executed: {command}","messagePattern":"Unsuccessful command executed: (.+?)","errorType":"exception","errorClass":"WebDriverException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/selenium_manager.py","lineNumber":149,"sourceCode":"\n        Args:\n            args: the components of the command being executed.\n\n        Returns:\n            The log string containing the driver location.\n        \"\"\"\n        command = \" \".join(args)\n        logger.debug(\"Executing process: %s\", command)\n        try:\n            if sys.platform == \"win32\":\n                completed_proc = subprocess.run(args, capture_output=True, creationflags=subprocess.CREATE_NO_WINDOW)\n            else:\n                completed_proc = subprocess.run(args, capture_output=True)\n            stdout = completed_proc.stdout.decode(\"utf-8\").rstrip(\"\\n\")\n            stderr = completed_proc.stderr.decode(\"utf-8\").rstrip(\"\\n\")\n            output = json.loads(stdout) if stdout != \"\" else {\"logs\": [], \"result\": {}}\n        except Exception as err:\n            raise WebDriverException(f\"Unsuccessful command executed: {command}\") from err\n\n        SeleniumManager._process_logs(output[\"logs\"])\n        result = output[\"result\"]\n        if completed_proc.returncode:\n            raise WebDriverException(\n                f\"Unsuccessful command executed: {command}; code: {completed_proc.returncode}\\n{result}\\n{stderr}\"\n            )\n        return result\n\n    @staticmethod\n    def _process_logs(log_items: list[dict]):\n        for item in log_items:\n            if item[\"level\"] == \"WARN\":\n                logger.warning(item[\"message\"])\n            elif item[\"level\"] in [\"DEBUG\", \"INFO\"]:\n                logger.debug(item[\"message\"])\n","sourceCodeStart":131,"sourceCodeEnd":166,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/selenium_manager.py#L131-L166","documentation":"Raised by SeleniumManager._run() inside a broad 'except Exception' around the subprocess.run call and the subsequent json.loads of stdout. It wraps ANY exception from launching the process or parsing its output, chaining the original via 'from err'. The message shows only the command string, so inspecting the chained exception (__cause__) is essential for the real cause.","triggerScenarios":"The selenium-manager binary cannot be executed at all: permission denied (not chmod +x), exec format error (wrong binary for the kernel/architecture), the process is killed by the OS, or the binary prints non-JSON output (e.g. a shared-library error message) causing json.JSONDecodeError.","commonSituations":"Binary downloaded for the wrong architecture, missing execute bit after a manual copy, missing shared libraries on a minimal Linux container (glibc/musl mismatch), or an SELinux/AppArmor policy denying execution. Also seen when FreeBSD/OpenBSD users run the Linux binary without Linux compatibility loaded.","solutions":["Check the chained exception: print the full traceback to read __cause__ (e.g. PermissionError, OSError 'Exec format error').","Ensure the binary is executable: chmod +x on the resolved path returned by the error.","If an ELF loader error appears, the binary does not match your kernel/architecture — set SE_MANAGER_PATH to a correct one or rebuild from rust/.","On BSD, run 'brandelf -t linux' on the binary and load the linux64 kernel module as the earlier warning suggests."],"exampleFix":"# before — broad error hides root cause\n#   WebDriverException: Unsuccessful command executed: /path/selenium-manager ...\n\n# after — surface the chained cause\nimport traceback, logging\nlogging.basicConfig(level=logging.DEBUG)\ntry:\n    driver = webdriver.Chrome()\nexcept Exception:\n    traceback.print_exc()  # prints __cause__ (PermissionError / OSError / JSONDecodeError)","handlingStrategy":"try-catch","validationCode":"import os, stat\nfrom selenium.webdriver.common.selenium_manager import SeleniumManager\np = SeleniumManager._get_binary()\nst = p.stat()\nif not (st.st_mode & stat.S_IXUSR):\n    raise PermissionError(f'{p} is not executable; run chmod +x')","typeGuard":"null","tryCatchPattern":"from selenium.common.exceptions import WebDriverException\ntry:\n    driver = webdriver.Chrome()\nexcept WebDriverException as e:\n    cause = e.__cause__\n    if isinstance(cause, PermissionError):\n        os.chmod(SeleniumManager._get_binary(), 0o755)\n    elif isinstance(cause, OSError):\n        # wrong arch / missing libs — rebuild or set SE_MANAGER_PATH\n        ...","preventionTips":["Enable DEBUG logging to see the command that failed.","Always inspect __cause__ on this exception, not just the message.","Verify the binary matches the host architecture before deploying."],"tags":["selenium-manager","subprocess","permissions","chained-exception","diagnostics"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}