{"record":{"id":"b2887751e24ab10b","repo":"passbolt/passbolt_api","slug":"the-identifier-should-be-a-valid-uuid-directoryignoretable","errorCode":null,"errorMessage":"The identifier should be a valid UUID.","messagePattern":"The identifier should be a valid UUID\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/DirectorySync/src/Model/Table/DirectoryIgnoreTable.php","lineNumber":188,"sourceCode":"            ],\n        ]);\n        $this->save($entity);\n\n        return $entity;\n    }\n\n    /**\n     * Create or fail\n     *\n     * @param string $foreignModel foreign model\n     * @param string $foreignKey foreign key\n     * @return \\Passbolt\\DirectorySync\\Model\\Entity\\DirectoryIgnore|bool\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if the $foreignKey is not a valid UUID\n     */\n    public function createOrFail(string $foreignModel, string $foreignKey): bool|DirectoryIgnore\n    {\n        if (!Validation::uuid($foreignKey)) {\n            throw new BadRequestException(__('The identifier should be a valid UUID.'));\n        }\n        try {\n            $entry = $this->get($foreignKey);\n        } catch (RecordNotFoundException $exception) {\n        }\n        if (isset($entry)) {\n            throw new BadRequestException(__('This record is already marked as to be ignored.'));\n        }\n\n        $ignore = $this->newEntity(\n            [\n                'id' => $foreignKey,\n                'foreign_model' => $foreignModel,\n            ],\n            [\n                'accessibleFields' => [\n                    'id' => true,\n                    'foreign_model' => true,","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/DirectorySync/src/Model/Table/DirectoryIgnoreTable.php#L170-L206","documentation":"BadRequestException raised by DirectoryIgnoreTable::createOrFail() when the $foreignKey argument is not a valid UUID. DirectoryIgnore records blacklist users/groups/entries from sync, keyed by foreign model and a UUID identifier, so a malformed identifier is rejected before any lookup.","triggerScenarios":"Calling createOrFail($foreignModel, $foreignKey) with a non-UUID $foreignKey — e.g. passing an LDAP DN, email, integer ID, or empty string instead of the passbolt user/group UUID.","commonSituations":"Custom scripts or report handlers passing LDAP entry identifiers instead of passbolt UUIDs when ignoring entries; integration code written before IDs became UUIDs; copy-paste of the wrong column value.","solutions":["Pass the passbolt user/group UUID (from the users/groups tables), not the LDAP DN or email","Validate the identifier with Validation::uuid($foreignKey) before calling createOrFail","If you only have an email/DN, resolve it to the passbolt entity UUID first (UsersTable/GroupsTable lookup)","Check calling code (sync reports, ignore controllers) for identifier mix-ups"],"exampleFix":"// before: DN passed as identifier\n$ignores->createOrFail('User', 'cn=jdoe,ou=people,dc=example,dc=com');\n// after: passbolt UUID resolved from the user\n$ignores->createOrFail('User', '9d8b0a1e-2f3c-4a5b-8c7d-6e5f4a3b2c1d');","handlingStrategy":"validation","validationCode":"use Cake\\Validation\\Validation;\n\nif (!Validation::uuid($foreignKey)) {\n    throw new \\InvalidArgumentException('$foreignKey must be a passbolt UUID');\n}\n$ignores->createOrFail($foreignModel, $foreignKey);","typeGuard":"$isValidUuid = is_string($foreignKey)\n    && preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i', $foreignKey) === 1;","tryCatchPattern":"try {\n    $ignores->createOrFail($foreignModel, $foreignKey);\n} catch (BadRequestException $e) {\n    if ($e->getMessage() === 'The identifier should be a valid UUID.') {\n        $this->log(\"Invalid ignore identifier: {$foreignKey}\", 'error');\n    }\n}","preventionTips":["Always pass passbolt UUIDs (users/groups tables), never LDAP DNs or emails","Resolve DN/email to the entity UUID before ignoring","Add Validation::uuid() pre-checks in custom sync/report scripts","Document that ignore records are keyed by UUID in integration docs"],"tags":["validation","uuid","directory-sync","bad-request"],"backgroundTag":"invalid-identifier-format","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"}