passbolt/passbolt_api · error · CakeException

The data entered are not correct

Error message

The data entered are not correct

What it means

EmailController::validateData runs EmailConfigurationForm with the 'webInstaller' validation set and throws CakeException 'The data entered are not correct' when execute() returns false. This validates SMTP/email settings posted in the WebInstaller email step before they are applied or used to send a test email.

Solutions

  1. Re-render the step and read the per-field errors from formExecuteResult to see which rule failed.
  2. Provide a valid sender email and name, and a syntactically valid SMTP host/port (e.g. host=smtp.example.com, port=587).
  3. Match the transport to your provider (SMTP) and verify credential format (no stray spaces, correct encoding).
  4. Validate the same settings with an external SMTP test (swaks/msmtp) before resubmitting.

Example fix

// before
{'sender_email': 'admin@', 'host': '', 'port': 'smtp'}
// after
{'sender_email': 'admin@example.com', 'sender_name': 'Passbolt', 'host': 'smtp.example.com', 'port': '587'}
Defensive patterns

Strategy: validation

Validate before calling

const emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRe.test(emailConfig.sender_email)) throw new Error('invalid sender_email');
if (!emailConfig.host || !/^[0-9]+$/.test(String(emailConfig.port))) throw new Error('invalid SMTP host/port');

Type guard

function isValidEmailConfig(c) {
  return c && typeof c.host === 'string' && c.host.length > 0 &&
    /^\d+$/.test(String(c.port)) &&
    typeof c.sender_email === 'string' && /@/.test(c.sender_email);
}

Try / catch

try {
  await post('/install/email', emailConfig);
} catch (e) {
  if (String(e.message).includes('The data entered are not correct')) {
    // inspect per-field errors from the re-rendered form and correct them
  }
  throw e;
}

Prevention

When it happens

Trigger: POSTing the WebInstaller email step with invalid values — missing sender email, malformed email address, empty host, bad port, or unsupported transport — so EmailConfigurationForm::execute($data, ['validate' => 'webInstaller']) fails.

Common situations: Typo in SMTP host; sender name/email left blank; non-numeric port; transport name the form does not accept; scripted requests omitting validated fields.

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


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/d683e88f38ecf55b. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltCe/WebInstaller/src/Controller/EmailController.php:125

        } else {
            $this->webInstaller->setSettingsAndSave('email', $data);
            $this->goToNextStep();
        }
    }

    /**
     * Validate data.
     *
     * @param array $data request data
     * @throws \Cake\Core\Exception\CakeException The data does not validate
     * @return void
     */
    protected function validateData(array $data)
    {
        $form = new EmailConfigurationForm();
        $this->set('formExecuteResult', $form);
        if (!$form->execute($data, ['validate' => 'webInstaller'])) {
            throw new CakeException(__('The data entered are not correct'));
        }
    }

    /**
     * Send test email.
     *
     * @param \Passbolt\SmtpSettings\Service\SmtpSettingsTestEmailService $sendTestEmailService Service injected for unit test purposes
     * @param array $data request data
     * @return void
     */
    protected function sendTestEmail(SmtpSettingsTestEmailService $sendTestEmailService, array $data)
    {
        try {
            $sendTestEmailService->sendTestEmail($data);
            $result = ['test_email_status' => true];
        } catch (Throwable $e) {
            $result = [
                'test_email_status' => false,

View on GitHub (pinned to 31c1bbc10f)