{"record":{"id":"abeee7e8077ba7f2","repo":"passbolt/passbolt_api","slug":"an-error-has-occurred-parsing-groupcustomfilter-pe","errorCode":null,"errorMessage":"An error has occurred parsing groupCustomFilter: {pe->getMessage()}","messagePattern":"An error has occurred parsing groupCustomFilter: (.+?)","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"plugins/PassboltEe/DirectorySync/src/Utility/LdapDirectory.php","lineNumber":589,"sourceCode":"     *\n     * @param \\LdapRecord\\Query\\Builder $query query\n     * @return \\LdapRecord\\Query\\Builder\n     * @throws \\InvalidArgumentException If groupCustomFilter callback is used.\n     * @throws \\InvalidArgumentException If groupCustomFilter cannot be parsed.\n     */\n    private function _customizeGroupsQuery(Builder $query): Builder\n    {\n        $groupCustomFilter = $this->directorySettings->getGroupCustomFilters();\n        if (is_callable($groupCustomFilter)) {\n            throw new InvalidArgumentException(\n                'Using callbacks for groupCustomFilter is not supported anymore. Please use LDAP search filter instead.'\n            );\n        } elseif (is_string($groupCustomFilter)) {\n            try {\n                $filter = Parser::parse($groupCustomFilter);\n                $query->rawFilter(Parser::assemble($filter));\n            } catch (ParserException $pe) {\n                throw new InvalidArgumentException(\n                    'An error has occurred parsing groupCustomFilter: ' . $pe->getMessage()\n                );\n            }\n        }\n\n        return $query;\n    }\n\n    /**\n     * Return filters used to retrieve users as a string, in ldapsearch format.\n     *\n     * @return string\n     * @throws \\Exception\n     */\n    public function getUserFiltersAsString(): string\n    {\n        $query = $this->_fetchAndInitializeUsersQuery();\n","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/DirectorySync/src/Utility/LdapDirectory.php#L571-L607","documentation":"The groupCustomFilter string is parsed as an LDAP search filter; on syntax failure the ParserException is caught and rethrown as an InvalidArgumentException wrapping the parser message, indicating the group custom filter string is not a valid LDAP filter.","triggerScenarios":"Calling _fetchAndInitializeGroupsQuery when the groupCustomFilter string fails Parser::parse() — malformed parentheses, operators, or escaping.","commonSituations":"Admin typo in the group filter field of directory sync settings, e.g. '(&(objectClass=group)(cn=passbolt-*' or filters using characters needing escaping like unescaped parentheses in CN values.","solutions":["Fix the groupCustomFilter string so it is a valid RFC 4515 filter (balanced parens, escaped special characters)","Use the parser message in the exception to pinpoint the syntax error","Test the filter with ldapsearch or an LDAP filter validator before saving"],"exampleFix":"// before\n$groupCustomFilter = '(&(objectClass=group)(cn=passbolt-*';\n// after\n$groupCustomFilter = '(&(objectClass=group)(cn=passbolt-*))';","handlingStrategy":"validation","validationCode":"try {\n    Parser::parse($groupCustomFilter);\n} catch (ParserException $e) {\n    // invalid filter, stop before group sync\n}","typeGuard":null,"tryCatchPattern":"try {\n    $result = $sync->run();\n} catch (InvalidArgumentException $e) {\n    if (str_contains($e->getMessage(), 'parsing groupCustomFilter')) {\n        // correct the group filter string\n    }\n}","preventionTips":["Validate group filters with ldapsearch before saving","Watch for unescaped special characters in CN values","Pin reviewed filter strings in config management"],"tags":["ldap","directory-sync","filter-parsing","configuration"],"backgroundTag":"invalid-regex-pattern","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"}