{"record":{"id":"865c58d474f8e48a","repo":"passbolt/passbolt_api","slug":"the-database-cannot-be-installed","errorCode":null,"errorMessage":"The database cannot be installed","messagePattern":"The database cannot be installed","errorType":"exception","errorClass":"Exception","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltCe/WebInstaller/src/Utility/WebInstaller.php","lineNumber":290,"sourceCode":"\n        /** @var \\App\\Model\\Table\\UsersTable $Users */\n        $Users = TableRegistry::getTableLocator()->get('Users');\n\n        return $Users->findFirstAdmin()->get('id');\n    }\n\n    /**\n     * Install database.\n     *\n     * @throws \\Exception The database cannot be installed\n     * @return void\n     */\n    public function installDatabase(): void\n    {\n        $migrations = new Migrations(['connection' => ConnectionManager::get('default')->configName()]);\n        $migrated = $migrations->migrate();\n        if (!$migrated) {\n            throw new Exception(__('The database cannot be installed'));\n        }\n    }\n\n    /**\n     * Create the first user.\n     *\n     * @throws \\App\\Error\\Exception\\CustomValidationException There was a problem creating the first user\n     * @throws \\App\\Error\\Exception\\CustomValidationException There was a problem creating the first user register token\n     * @return void\n     */\n    public function createFirstUser(): void\n    {\n        $userData = $this->getSettings('first_user');\n        if (empty($userData)) {\n            return;\n        }\n\n        /** @var \\App\\Model\\Table\\UsersTable $Users */","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/WebInstaller/src/Utility/WebInstaller.php#L272-L308","documentation":"WebInstaller::installDatabase() runs the CakePHP migrations via the Migrations (phinx) wrapper and throws when migrate() reports that nothing was migrated. It signals the web installer could not create or update the passbolt database schema.","triggerScenarios":"Calling installDatabase() during the web installer database step when the Migrations migrate() call returns false, meaning a phinx migration aborted (SQL error, lock, bad connection config).","commonSituations":"Wrong DB credentials or host entered in the wizard's database form; DB user lacks privileges; unsupported database server version (old MySQL/MariaDB/Postgres); leftover phinx migration lock or partially applied migrations from a previous failed attempt.","solutions":["Re-check the database form values (host, port, database, user, password) and that the user has full privileges on the schema.","Run the migration from CLI to see the underlying phinx error: bin/cake passbolt migrate; fix the reported SQL or connection error.","Confirm the database server version is supported (MySQL 5.7/8, MariaDB >= 10.4, Postgres > 14).","Check for a leftover migration lock or failed migration state, resolve it, then retry the install step."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"ConnectionManager::get('default')->query('SELECT 1'); // DB reachable & credentials valid before install step","typeGuard":null,"tryCatchPattern":"try {\n    $installer->installDatabase();\n} catch (\\Exception $e) {\n    // inspect the real phinx error via CLI: bin/cake passbolt migrate\n}","preventionTips":["Validate DB credentials and server version before starting the wizard.","Prefer CLI migrations where the underlying error is visible.","Clear stale migration locks after failed attempts.","Test migrations on a staging database with matching server versions."],"tags":["webinstaller","database","migrations","phinx"],"backgroundTag":"database-migration-failed","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}