{"record":{"id":"f4235b9b4b8b116a","repo":"passbolt/passbolt_api","slug":"the-data-entered-are-not-correct-databasecontroller","errorCode":null,"errorMessage":"The data entered are not correct","messagePattern":"The data entered are not correct","errorType":"exception","errorClass":"CakeException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/WebInstaller/src/Controller/DatabaseController.php","lineNumber":201,"sourceCode":"            $msg = __('A connection could not be established with the credentials provided.') . ' ';\n            $msg .= __('Please verify the settings.');\n            throw new CakeException($msg);\n        }\n    }\n\n    /**\n     * Validate data.\n     *\n     * @param array $data request data\n     * @throws \\Cake\\Core\\Exception\\CakeException The data does not validate\n     * @return array\n     */\n    protected function validateData(array $data): array\n    {\n        $form = new DatabaseConfigurationForm();\n        $this->set('formExecuteResult', $form);\n        if (!$form->execute($data)) {\n            throw new CakeException(__('The data entered are not correct'));\n        }\n        /** @var array $data */\n        $data = $form->getData();\n\n        return $data;\n    }\n}\n","sourceCodeStart":183,"sourceCodeEnd":209,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/WebInstaller/src/Controller/DatabaseController.php#L183-L209","documentation":"DatabaseController::validateData executes DatabaseConfigurationForm against the posted settings and throws CakeException 'The data entered are not correct' when the form fails validation. Unlike the connection test (reachability), this fires before any DB attempt because the submitted values do not satisfy the form's field rules. Detailed errors are attached to the form exposed as formExecuteResult.","triggerScenarios":"POSTing the WebInstaller database step with missing or invalid fields: absent driver/host/username/database, an unsupported driver name, non-numeric port, or empty required values — DatabaseConfigurationForm::execute() returns false.","commonSituations":"Empty installer form submission; driver whose PDO extension is missing (e.g. pdo_pgsql not installed); typo'd field names when scripting; port with stray characters.","solutions":["Inspect formExecuteResult / the re-rendered form for the exact failing field and rule.","Ensure all required fields are present: driver (mysql/mariadb/postgres...), host, port, username, database, and password if required.","Check the chosen driver's PDO extension is installed (php -m | grep pdo) and supported by the form.","Resubmit via the installer UI so the form revalidates with corrected values."],"exampleFix":"// before\n{'driver': 'oracle', 'host': '', 'port': 'abc'}\n// after\n{'driver': 'mysql', 'host': 'db', 'port': '3306', 'username': 'passbolt', 'password': '****', 'database': 'passbolt'}","handlingStrategy":"validation","validationCode":"const required = ['driver', 'host', 'port', 'username', 'database'];\nfor (const k of required) {\n  if (!dbConfig[k] || !String(dbConfig[k]).trim()) throw new Error(k + ' is required');\n}\nif (!['mysql', 'mariadb', 'postgres'].includes(dbConfig.driver)) throw new Error('unsupported driver');\nif (!/^[0-9]+$/.test(String(dbConfig.port))) throw new Error('port must be numeric');","typeGuard":"function isValidDatabaseForm(d) {\n  return d && typeof d === 'object' &&\n    ['mysql','mariadb','postgres'].includes(d.driver) &&\n    typeof d.host === 'string' && d.host &&\n    /^\\d+$/.test(String(d.port));\n}","tryCatchPattern":"try {\n  await post('/install/database', dbConfig);\n} catch (e) {\n  if (String(e.message).includes('The data entered are not correct')) {\n    // read formExecuteResult field errors from the re-rendered step, fix, resubmit\n  }\n  throw e;\n}","preventionTips":["Submit every required field; never send empty strings for required values.","Use only drivers the form supports and whose PDO extension is installed.","Send numeric ports without extra characters.","Prefer the installer UI over hand-crafted requests to stay within field rules."],"tags":["webinstaller","form-validation","database-config"],"backgroundTag":"invalid-config-value","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"}