passbolt/passbolt_api · error · CakeException
The data entered are not correct
Error message
The data entered are not correct: {0} What it means
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.
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.
Example fix
// before
{'name': '', 'email': 'not-an-email', 'key_length': '1024', 'expire_date': 'yesterday'}
// after
{'name': 'Ada Lovelace', 'email': 'ada@example.com', 'key_length': '3072', 'expire_date': '2031-01-01'} Defensive patterns
Strategy: validation
Validate before calling
const { name, email, key_length, expire_date } = gpgParams;
if (!name || !name.trim()) throw new Error('name is required');
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) throw new Error('invalid email');
if (![2048, 3072, 4096].includes(Number(key_length))) throw new Error('unsupported key length');
if (isNaN(Date.parse(expire_date)) || new Date(expire_date) <= new Date()) throw new Error('expiration must be a valid future date'); Type guard
function isValidGpgKeyParams(p) {
return p && typeof p.name === 'string' && p.name.trim() &&
typeof p.email === 'string' && /@/.test(p.email) &&
Number(p.key_length) >= 2048;
} Try / catch
try {
await post('/install/gpg_key_generate', gpgParams);
} catch (e) {
if (String(e.message).startsWith('The data entered are not correct:')) {
// parse the {0} error list to see exactly which fields failed
const details = String(e.message).split(':').slice(1).join(':');
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- The data entered are not correct
- A valid OpenPGP key must be provided.
- Could not import the user OpenPGP key.
- Could not validate message data.
- Could not validate user data.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/4a1311569051cc2d.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/WebInstaller/src/Controller/GpgKeyGenerateController.php:45
*/
public function initialize(): void
{
parent::initialize();
$this->stepInfo['template'] = 'Pages/gpg_key_generate';
$this->stepInfo['import_key_cta'] = '/install/gpg_key_import';
}
/**
* @inheritDoc
*/
protected function validateData(array $data): void
{
$form = new GpgKeyForm();
if (!$form->execute($data)) {
$this->set('formExecuteResult', $form);
$errors = Hash::flatten($form->getErrors());
$errorMessage = implode('; ', $errors);
throw new CakeException(__('The data entered are not correct: {0}', $errorMessage));
}
}
}
View on GitHub (pinned to 31c1bbc10f)