{"record":{"id":"73cde91efcf94ca6","repo":"passbolt/passbolt_api","slug":"there-was-an-issue-while-retrieving-the-invalid-entries","errorCode":null,"errorMessage":"There was an issue while retrieving the invalid entries.","messagePattern":"There was an issue while retrieving the invalid entries\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/DirectorySync/src/Controller/DirectorySettingsController.php","lineNumber":155,"sourceCode":"            ];\n        } catch (Exception $e) {\n            throw new BadRequestException('The users and groups cannot be retrieved. ' . $e->getMessage());\n        }\n\n        try {\n            $outputData['tree'] = $this->_toArray($filteredDirectoryResults->getTree());\n        } catch (Exception $e) {\n            $msg = __('The directory structure cannot be retrieved.');\n            throw new BadRequestException($msg . ' ' . $e->getMessage());\n        }\n\n        try {\n            $invalidObjects = $filteredDirectoryResults->getInvalidGroups();\n            $invalidObjects = array_merge($invalidObjects, $filteredDirectoryResults->getInvalidUsers());\n            $outputData['errors'] = $this->_toArray($invalidObjects);\n        } catch (Exception $e) {\n            $msg = __('There was an issue while retrieving the invalid entries.');\n            throw new BadRequestException($msg . ' ' . $e->getMessage());\n        }\n\n        $this->success(__('The operation was successful.'), $outputData);\n    }\n\n    /**\n     * Disable the ldap integration.\n     *\n     * @return void\n     */\n    public function disable()\n    {\n        if (!$this->User->isAdmin()) {\n            throw new ForbiddenException(__('You are not authorized to access that location.'));\n        }\n\n        $uac = $this->User->getAccessControl();\n        DirectoryOrgSettings::disable($uac);","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/DirectorySync/src/Controller/DirectorySettingsController.php#L137-L173","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the appended $e->getMessage() for the underlying cause","Check passbolt error logs (logs/error.log) around the request time","Re-run the test endpoint; if persistent, check for plugin version mismatches between DirectorySync and the core app (composer / ddev refresh)","Fix or exclude the offending LDAP entries via filters and re-test"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// ensure LDAP entries have minimal valid attributes before sync\nconst invalid = entries.filter(e => !e.dn || !e.email);\nif (invalid.length) console.warn('Fix these entries first:', invalid.map(e => e.dn));","typeGuard":"$invalidGroups = $filteredDirectoryResults->getInvalidGroups();\nif (!is_iterable($invalidGroups)) {\n    throw new BadRequestException('Invalid groups collection is malformed.');\n}","tryCatchPattern":"try {\n    await api.post('/directorysync/settings/test', settings);\n} catch (e) {\n    if (e.message.includes('invalid entries')) {\n        inspectLdapEntriesAndLogs(e.message);\n    }\n}","preventionTips":["Ensure LDAP entries have well-formed DNs and emails","Keep the DirectorySync plugin and core app versions in lock-step","Re-run the test endpoint after LDAP directory changes","Fix reported invalid entries rather than ignoring them repeatedly"],"tags":["ldap","directory-sync","bad-request"],"backgroundTag":"unexpected-response-shape","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}