passbolt/passbolt_api · warning

users returned by your directory are invalid and will be…

Error message

{0} users returned by your directory are invalid and will be ignored during synchronization

What it means

TestCommand::displayInvalidEntries warns that N users returned by the directory failed entity validation and will be skipped during synchronization. This is an expected informational diagnostic: the directory data was fetched, but entries don't satisfy passbolt user entity rules. The count is interpolated via the {0} placeholder.

Solutions

  1. Re-run with --verbose to see per-user getErrorsAsString() details printed after this message.
  2. Fix the offending directory entries (add/repair mail attribute, correct OU scope).
  3. Review attribute mapping configuration so required user fields are populated.
  4. Exclude invalid OUs/entries from the directory sync search scope.
Defensive patterns

Strategy: validation

Validate before calling

$invalid = array_filter($users, fn($u) => (bool)$u->getErrors());
if ($invalid) { echo count($invalid) . " invalid users will be skipped\n"; }

Type guard

foreach ($data['users'] as $user) {
    if (!($user instanceof \App\Model\Entity\User)) { continue; }
    if ($user->getErrors()) { /* handle */ }
}

Prevention

When it happens

Trigger: `bin/cake passbolt directory_sync test` where $directoryResults->getUsers() contains entities that failed validation (e.g. missing email, invalid DN mapping, missing first/last name rules).

Common situations: Directory entries without mail attribute, entries mapped from wrong OUs, attribute mapping misconfigured so required user fields are empty, or entries failing unique-email checks against existing users.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at plugins/PassboltEe/DirectorySync/src/Command/TestCommand.php:190

        }

        $io->info(__('The following groups and users have been found'));
        $io->out($io->nl(1));
        $io->helper('Table')->output($output);
    }

    /**
     * Display invalid objects.
     *
     * @param array $data data
     * @param \Cake\Console\ConsoleIo $io Console IO.
     * @return void
     */
    protected function displayInvalidEntries(array $data, ConsoleIo $io): void
    {
        if (count($data['users'])) {
            $io->hr();
            $io->err(
                __(
                    '{0} users returned by your directory are invalid and will be ignored during synchronization',
                    count($data['users'])
                )
            );
            $io->err(__('bin/cake directory_sync test --verbose for more details'));
            $io->hr();
            foreach ($data['users'] as $user) {
                $io->verbose(__('Error: ') . $user->getErrorsAsString());
                $io->verbose(json_encode($user->toArray(), JSON_PRETTY_PRINT));
            }
        }

        if (count($data['groups'])) {
            $io->hr();
            $io->err(
                __(
                    '{0} group(s) returned by your directory are invalid and will be ignored during synchronization',

View on GitHub (pinned to 31c1bbc10f)