{"record":{"id":"beadd52f346d1825","repo":"passbolt/passbolt_api","slug":"healthcheckservice-getfailuremessage","errorCode":null,"errorMessage":"$healthcheckService->getFailureMessage()","messagePattern":"\\$healthcheckService->getFailureMessage\\(\\)","errorType":"console","errorClass":"CakeException","httpStatus":null,"severity":"error","filePath":"src/Command/InstallCommand.php","lineNumber":419,"sourceCode":"     *\n     * @param \\Cake\\Console\\Arguments $args Arguments.\n     * @param \\Cake\\Console\\ConsoleIo $io Console IO.\n     * @return bool status success\n     */\n    protected function healthchecks(Arguments $args, ConsoleIo $io): bool\n    {\n        $io->nl();\n        $io->out(__('Running baseline checks, please wait...'));\n        $healthcheckServices = $this->getInstallCheckHealthcheckServices();\n        try {\n            foreach ($healthcheckServices as $healthcheckService) {\n                if ($healthcheckService instanceof HealthcheckWithOptionsInterface) {\n                    $healthcheckService->setOptions($args->getOptions());\n                }\n\n                $healthcheckService->check();\n                if (!$healthcheckService->isPassed()) {\n                    throw new CakeException($healthcheckService->getFailureMessage());\n                }\n            }\n        } catch (CakeException $e) {\n            $this->error($e->getMessage(), $io);\n            $this->error(__('Please run ./bin/cake passbolt healthcheck for more information and help.'), $io);\n\n            return false;\n        }\n\n        // If force is false, and database is populated, warn\n        if (!$args->getOption('force')) {\n            /** @var \\App\\Service\\Healthcheck\\Database\\TablesCountDatabaseHealthcheck $tableCountCheck */\n            $tableCountCheck = $this->healthcheckServiceCollector\n                ->getService(TablesCountDatabaseHealthcheck::class);\n            $tableCountCheck->check();\n            if ($tableCountCheck->isPassed()) {\n                $msg = __('Some tables are already present in the database.') . ' ';\n                $msg .= __('A new installation would override existing data.');","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/src/Command/InstallCommand.php#L401-L437","documentation":"During 'bin/cake passbolt install', every registered healthcheck service is run; if any healthcheck->check() fails (isPassed() false), InstallCommand aborts by throwing a CakeException whose message comes from the failing healthcheck's getFailureMessage(). It is a generic gate: the actual cause is whatever subsystem failed (GPG, SSL, database, config, etc.).","triggerScenarios":"Running the install command in an environment where any healthcheck fails: missing server GPG key, unparseable SSL certificate, invalid passbolt.php config, unreachable database, bad folder permissions, etc.","commonSituations":"Fresh installs with incomplete passbolt.php; server key not generated (bin/cake passbolt create_gpg_server_key); self-signed or expired SSL certs; wrong database credentials; running install twice after partial failure.","solutions":["Run 'bin/cake passbolt healthcheck' as the message suggests — it names the exact failing check and remediation.","Fix the specific failing check (e.g. generate server key, fix config/keys/ssl) before re-running install.","Ensure the command runs as the web server user (e.g. su -s /bin/bash -c 'bin/cake passbolt install' www-data) since some checks are user/permission-sensitive.","Verify env variables and passbolt.php values with 'bin/cake passbolt verify' or a config review."],"exampleFix":"// before: install aborts\n$ bin/cake passbolt install\nError: The server key does not exist...\n// after: fix the check then retry\n$ sudo su -s /bin/bash -c './bin/cake passbolt create_gpg_server_key' www-data\n$ bin/cake passbolt install","handlingStrategy":"validation","validationCode":"$healthcheck = new FooHealthcheck();\n$healthcheck->check();\nif (!$healthcheck->isPassed()) {\n    fwrite(STDERR, 'Install would fail: ' . $healthcheck->getFailureMessage() . PHP_EOL);\n    exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n    (new InstallCommand())->execute($args, $io);\n} catch (CakeException $e) {\n    // run 'bin/cake passbolt healthcheck' and fix the named check\n    $this->error($e->getMessage());\n}","preventionTips":["Always run 'bin/cake passbolt healthcheck' before install.","Automate pre-install checks in provisioning scripts.","Run install as the web server user with correct permissions.","Keep server GPG key and SSL config set up before installing."],"tags":["cli","healthcheck","installation","configuration"],"backgroundTag":"healthcheck-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"}