passbolt/passbolt_api · error · BadRequestException

There was an issue while retrieving the invalid entries.

Error message

There was an issue while retrieving the invalid entries.

What it means

Thrown by DirectorySettingsController::test() when retrieving the invalid groups/users from FilteredDirectoryResults (getInvalidGroups()/getInvalidUsers()) or merging/converting them fails. These 'invalid entries' are LDAP objects that failed validation against passbolt rules and are reported back to the admin during a settings dry-run test.

Solutions

  1. Inspect the appended $e->getMessage() for the underlying cause
  2. Check passbolt error logs (logs/error.log) around the request time
  3. Re-run the test endpoint; if persistent, check for plugin version mismatches between DirectorySync and the core app (composer / ddev refresh)
  4. Fix or exclude the offending LDAP entries via filters and re-test

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure LDAP entries have minimal valid attributes before sync
const invalid = entries.filter(e => !e.dn || !e.email);
if (invalid.length) console.warn('Fix these entries first:', invalid.map(e => e.dn));

Type guard

$invalidGroups = $filteredDirectoryResults->getInvalidGroups();
if (!is_iterable($invalidGroups)) {
    throw new BadRequestException('Invalid groups collection is malformed.');
}

Try / catch

try {
    await api.post('/directorysync/settings/test', settings);
} catch (e) {
    if (e.message.includes('invalid entries')) {
        inspectLdapEntriesAndLogs(e.message);
    }
}

Prevention

When it happens

Trigger: POST /directorysync/settings/test where getInvalidGroups(), getInvalidUsers(), or _toArray() on them throws an Exception — typically unexpected entity types in the invalid-collection or an internal error in the results object.

Common situations: LDAP entries with DNs or emails that break entity normalization; corrupted FilteredDirectoryResults after an earlier partial failure; plugin version mismatches where results collections changed shape.

Related errors


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

Appendix: source

Thrown at plugins/PassboltEe/DirectorySync/src/Controller/DirectorySettingsController.php:155

            ];
        } catch (Exception $e) {
            throw new BadRequestException('The users and groups cannot be retrieved. ' . $e->getMessage());
        }

        try {
            $outputData['tree'] = $this->_toArray($filteredDirectoryResults->getTree());
        } catch (Exception $e) {
            $msg = __('The directory structure cannot be retrieved.');
            throw new BadRequestException($msg . ' ' . $e->getMessage());
        }

        try {
            $invalidObjects = $filteredDirectoryResults->getInvalidGroups();
            $invalidObjects = array_merge($invalidObjects, $filteredDirectoryResults->getInvalidUsers());
            $outputData['errors'] = $this->_toArray($invalidObjects);
        } catch (Exception $e) {
            $msg = __('There was an issue while retrieving the invalid entries.');
            throw new BadRequestException($msg . ' ' . $e->getMessage());
        }

        $this->success(__('The operation was successful.'), $outputData);
    }

    /**
     * Disable the ldap integration.
     *
     * @return void
     */
    public function disable()
    {
        if (!$this->User->isAdmin()) {
            throw new ForbiddenException(__('You are not authorized to access that location.'));
        }

        $uac = $this->User->getAccessControl();
        DirectoryOrgSettings::disable($uac);

View on GitHub (pinned to 31c1bbc10f)