passbolt/passbolt_api · critical · InternalErrorException
Could not save the directory entry.
Error message
Could not save the directory entry.
What it means
InternalErrorException thrown by DirectoryEntriesTable::create() when save() returns falsy and no validation errors are present — an unexpected persistence failure (e.g. database constraint violation, connection issue) not attributable to validation.
Solutions
- Check database server logs for the underlying write error at the time of the sync
- Run migrations to confirm the directory_entries schema matches the code
- Verify DB disk space and connection limits
- Retry the sync once transient DB issues are resolved
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
// confirm DB connectivity before sync
$connection = \Cake\Datasource\ConnectionFactoryLocator::get()->get();
$connection->execute('SELECT 1'); // throws early if DB is down Type guard
null
Try / catch
try {
$entriesTable->create($data);
} catch (InternalErrorException $e) {
// no validation errors: persistence failed; check DB logs then retry
$this->log('Directory entry save failed without validation errors', 'error');
retryWithBackoff(fn() => $entriesTable->create($data), 2);
} Prevention
- Monitor database disk space and connection limits
- Keep migrations current so constraints match the code
- Avoid overlapping long sync jobs that hold locks
- Alert on DB write errors in logs/error.log
When it happens
Trigger: updateOrCreate() -> create() where $this->save($directoryEntry) returns false with a clean entity: DB write failure, constraint violation, table lock, or connection loss during sync.
Common situations: Database out of disk space or read-only replica; MySQL/Postgres constraint from stale migrations; long-running syncs hitting connection timeouts; locking contention from concurrent sync jobs.
Related errors
- 500
- An unexpected error occurred while creating the user in the…
- Could not create the folder, please try again later.
- Could not create the resource folder relation, please try…
- Could not delete the draft SSO settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/3fa41b57b8d8ffd6.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/DirectorySync/src/Model/Table/DirectoryEntriesTable.php:238
*/
public function create(array $data): bool|DirectoryEntry
{
// Check validation rules.
$directoryEntry = $this->buildEntityFromData($data);
if (!empty($directoryEntry ->getErrors())) {
throw new ValidationException(__('Could not validate directory entry data.'), $directoryEntry, $this);
}
$de = $this->save($directoryEntry);
// Check for validation errors. (associated models too).
if (!empty($directoryEntry->getErrors())) {
throw new ValidationException(__('Could not validate directory entry data.'), $directoryEntry, $this);
}
// Check for errors while saving.
if (!$de) {
throw new InternalErrorException('Could not save the directory entry.');
}
return $de;
}
/**
* Find a directory entries if it exist or create one
* Will update the name if it changed in the directory (example: DN changed)
*
* @param array $data data
* @param string $model model
* @return \Passbolt\DirectorySync\Model\Entity\DirectoryEntry|array|bool
*/
public function updateOrCreate(array $data, string $model): array|bool|DirectoryEntry
{
try {
return $this->getConnection()->transactional(
function () use ($data, $model): DirectoryEntry|bool {View on GitHub (pinned to 31c1bbc10f)