passbolt/passbolt_api · error · BadRequestException
Could not save the settings.
Error message
Could not save the settings. {0} What it means
Thrown when LdapConfigurationForm::execute() throws during POST /directorysync/settings — validation passed but execution (e.g. testing the configuration against the LDAP server) failed. The original exception message is interpolated into '{0}' and attached as the previous exception, returned as HTTP 400.
Solutions
- Check the interpolated message and the chained exception in server logs for the root cause.
- Verify LDAP server reachability with ldapsearch/ldapwhoami from the passbolt host.
- Confirm bind DN/password and base DN are correct.
- If using LDAPS, ensure the CA certificate is trusted by the container/host.
- Ensure the php-ldap extension is installed and enabled (`php -m | grep ldap`).
Example fix
// before "ldap.username": "cn=admin,dc=example,dc=com" (wrong password) // 400 Could not save the settings. Invalid credentials // after # verify credentials outside passbolt first ldapwhoami -H ldaps://ldap.example.com:636 -D 'cn=admin,dc=example,dc=com' -W # then submit corrected settings
Defensive patterns
Strategy: try-catch
Try / catch
try {
await api.post('/directorysync/settings.json', payload);
} catch (e) {
if (e.response?.status === 400 && String(e.response.data?.message || '').startsWith('Could not save the settings.')) {
const cause = e.response.data.message.replace('Could not save the settings. ', '');
// cause is the LDAP execution error: fix credentials/connectivity before retry
}
throw e;
} Prevention
- Test LDAP reachability and bind with ldapsearch/ldapwhoami from the passbolt host before saving settings.
- Ensure php-ldap is installed on the server/container image.
- Pre-trust your LDAPS CA certificates.
- Use /directorysync/test to execute settings without saving, iterating until it passes.
When it happens
Trigger: POST /directorysync/settings where the payload validates but $form->execute($data) fails — e.g. LDAP bind/connect test fails during execution, or an unexpected error occurs while processing the configuration.
Common situations: Wrong bind credentials or DN; LDAP server unreachable from the passbolt server (firewall, DNS); TLS/certificate issues (self-signed cert without proper CA); PHP LDAP extension missing on the host; typo'd base DN.
Related errors
- The settings provided are incorrect.
- 500
- A mapping rule for ID attribute could not be found for…
- A mapping rule for username attribute could not be found…
- An error has occurred parsing groupCustomFilter
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/255b29f134724076.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/DirectorySync/src/Controller/DirectorySettingsController.php:87
*
* @return void
*/
public function update()
{
if (!$this->User->isAdmin()) {
throw new ForbiddenException(__('You are not authorized to access that location.'));
}
$data = $this->request->getData();
$form = new LdapConfigurationForm();
if (!$form->validate($data)) {
$errors = $form->getErrors();
throw new CustomValidationException(__('Could not validate settings.'), $errors);
}
try {
$form->execute($data);
} catch (Exception $e) {
throw new BadRequestException(
__('Could not save the settings. {0}', $e->getMessage()),
null,
$e
);
}
$uac = $this->User->getAccessControl();
$settings = LdapConfigurationForm::formatFormDataToOrgSettings($data);
$directoryOrgSettings = new DirectoryOrgSettings($settings);
$directoryOrgSettings->save($uac);
$this->success(__('The operation was successful.'));
}
/**
* Test provided settings without saving them, and return directory results.
*
* @return voidView on GitHub (pinned to 31c1bbc10f)