{"record":{"id":"f424621afbfb5b47","repo":"sebastianbergmann/phpunit","slug":"cannot-open-bootstrap-script-s","errorCode":null,"errorMessage":"Cannot open bootstrap script \"%s\"","messagePattern":"Cannot open bootstrap script \"(.+?)\"","errorType":"exception","errorClass":"BootstrapScriptDoesNotExistException","httpStatus":null,"severity":"error","filePath":"src/TextUI/Configuration/BootstrapLoader.php","lineNumber":57,"sourceCode":"            if ($configuration->includeTestSuites() !== [] && !in_array($testSuiteName, $configuration->includeTestSuites(), true)) {\n                continue;\n            }\n\n            if ($configuration->excludeTestSuites() !== [] && in_array($testSuiteName, $configuration->excludeTestSuites(), true)) {\n                continue;\n            }\n\n            $this->load($bootstrapForTestSuite);\n        }\n    }\n\n    /**\n     * @param non-empty-string $filename\n     */\n    private function load(string $filename): void\n    {\n        if (!is_readable($filename)) {\n            throw new BootstrapScriptDoesNotExistException($filename);\n        }\n\n        try {\n            include_once $filename;\n        } catch (Throwable $t) {\n            $message = sprintf(\n                'Error in bootstrap script: %s:%s%s%s%s',\n                $t::class,\n                PHP_EOL,\n                $t->getMessage(),\n                PHP_EOL,\n                $t->getTraceAsString(),\n            );\n\n            while (($t = $t->getPrevious()) !== null) {\n                $message .= sprintf(\n                    '%s%sPrevious error: %s:%s%s%s%s',\n                    PHP_EOL,","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/sebastianbergmann/phpunit/blob/f123cdb2a2d49f15025794166cfed8bda8627dd2/src/TextUI/Configuration/BootstrapLoader.php#L39-L75","documentation":"BootstrapLoader::load() (via handle(), driven by the bootstrap attribute in phpunit.xml or --bootstrap on the CLI) first checks is_readable($filename); when that fails it throws BootstrapScriptDoesNotExistException('Cannot open bootstrap script \"%s\"'). The bootstrap file must exist and be readable before PHPUnit will include it.","triggerScenarios":"Configuring bootstrap=\"vendor/autoload.php\" (or --bootstrap) when the file is missing — e.g. composer install has not run — or exists but is not readable by the PHP process.","commonSituations":"Fresh clones without 'composer install'; bootstrap path relative to the CWD while phpunit runs from another directory; path typos in phpunit.xml; permission problems in containers/CI.","solutions":["Create the missing file — usually by running composer install for vendor/autoload.php.","Fix the bootstrap path in phpunit.xml/--bootstrap; relative paths resolve against the CWD, so prefer a path relative to the configuration file.","Make the file readable by the PHP process if permissions are the issue."],"exampleFix":"# before\ncomposer dump-coverage 2>/dev/null; phpunit --bootstrap vendor/autoload.php tests\n# => Cannot open bootstrap script \"vendor/autoload.php\"\n\n# after\ncomposer install\nphpunit --bootstrap vendor/autoload.php tests","handlingStrategy":"validation","validationCode":"$bootstrap = 'vendor/autoload.php';\n\nif (!is_readable($bootstrap)) {\n    throw new RuntimeException(\n        \"Bootstrap '{$bootstrap}' missing or unreadable; run 'composer install' first\"\n    );\n}\n\n// only then hand off to phpunit / BootstrapLoader","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make 'composer install' (or the script that creates the bootstrap) a mandatory CI step before phpunit.","Reference the bootstrap relative to the phpunit.xml location, not the CWD.","Add a smoke check (is_readable) in CI wrapper scripts to fail with a clear message."],"tags":["phpunit","bootstrap","configuration","composer","file-not-found"],"backgroundTag":"missing-bootstrap-file","analyzedSha":"f123cdb2a2d49f15025794166cfed8bda8627dd2","analyzedAt":"2026-08-23T01:20:58.058Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}