{"record":{"id":"4a1311569051cc2d","repo":"passbolt/passbolt_api","slug":"the-data-entered-are-not-correct-0","errorCode":null,"errorMessage":"The data entered are not correct: {0}","messagePattern":"The data entered are not correct: (.+?)","errorType":"exception","errorClass":"CakeException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/WebInstaller/src/Controller/GpgKeyGenerateController.php","lineNumber":45,"sourceCode":"     */\n    public function initialize(): void\n    {\n        parent::initialize();\n        $this->stepInfo['template'] = 'Pages/gpg_key_generate';\n        $this->stepInfo['import_key_cta'] = '/install/gpg_key_import';\n    }\n\n    /**\n     * @inheritDoc\n     */\n    protected function validateData(array $data): void\n    {\n        $form = new GpgKeyForm();\n        if (!$form->execute($data)) {\n            $this->set('formExecuteResult', $form);\n            $errors = Hash::flatten($form->getErrors());\n            $errorMessage = implode('; ', $errors);\n            throw new CakeException(__('The data entered are not correct: {0}', $errorMessage));\n        }\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":49,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/WebInstaller/src/Controller/GpgKeyGenerateController.php#L27-L49","documentation":"GpgKeyGenerateController::validateData runs GpgKeyForm against the key-generation parameters and throws CakeException 'The data entered are not correct: {0}' with flattened, semicolon-joined form errors. Unlike other installer forms, this message includes the actual validation errors inline, showing which key parameters were rejected.","triggerScenarios":"POSTing the WebInstaller GPG key generation step with invalid parameters — bad name/email format, key length outside the allowed set, invalid expiration date, or missing required fields — so GpgKeyForm::execute($data) returns false.","commonSituations":"Unsupported key size (e.g. 1024); invalid expiration date format; empty name/email; wrong field names in scripted requests; gpg/gnupg environment issues surfacing at validation time.","solutions":["Read the {0} portion of the message — the flattened errors name the failing fields and rules.","Use a supported key type/length (e.g. RSA 2048/3072/4096) and a valid future expiration date.","Provide a valid name and email for the key owner; ensure required fields are non-empty.","Retry via the installer UI, which restricts inputs to valid ranges."],"exampleFix":"// before\n{'name': '', 'email': 'not-an-email', 'key_length': '1024', 'expire_date': 'yesterday'}\n// after\n{'name': 'Ada Lovelace', 'email': 'ada@example.com', 'key_length': '3072', 'expire_date': '2031-01-01'}","handlingStrategy":"validation","validationCode":"const { name, email, key_length, expire_date } = gpgParams;\nif (!name || !name.trim()) throw new Error('name is required');\nif (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) throw new Error('invalid email');\nif (![2048, 3072, 4096].includes(Number(key_length))) throw new Error('unsupported key length');\nif (isNaN(Date.parse(expire_date)) || new Date(expire_date) <= new Date()) throw new Error('expiration must be a valid future date');","typeGuard":"function isValidGpgKeyParams(p) {\n  return p && typeof p.name === 'string' && p.name.trim() &&\n    typeof p.email === 'string' && /@/.test(p.email) &&\n    Number(p.key_length) >= 2048;\n}","tryCatchPattern":"try {\n  await post('/install/gpg_key_generate', gpgParams);\n} catch (e) {\n  if (String(e.message).startsWith('The data entered are not correct:')) {\n    // parse the {0} error list to see exactly which fields failed\n    const details = String(e.message).split(':').slice(1).join(':');\n  }\n  throw e;\n}","preventionTips":["Use key lengths the form accepts (RSA >= 2048).","Provide a real future expiration date or the form's accepted 'never' value.","Enter a valid name/email pair for the key identity.","Read the inline error list in the message before retrying."],"tags":["webinstaller","form-validation","gpg","openpgp"],"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"}