{"record":{"id":"e3f6b4a6f4674ccc","repo":"passbolt/passbolt_api","slug":"the-record-could-not-be-found","errorCode":null,"errorMessage":"The record could not be found.","messagePattern":"The record could not be found\\.","errorType":"console","errorClass":"RecordNotFoundException","httpStatus":null,"severity":"error","filePath":"plugins/PassboltEe/DirectorySync/src/Command/IgnoreDeleteCommand.php","lineNumber":66,"sourceCode":"     */\n    public function execute(Arguments $args, ConsoleIo $io): ?int\n    {\n        parent::execute($args, $io);\n\n        $foreignModel = $args->getOption('model');\n        $foreignKey = $args->getOption('id');\n\n        if (!Validation::inList($foreignModel, ['Groups', 'Users', 'DirectoryEntries'])) {\n            $io->err(__('The record model is not valid.'));\n\n            return $this->errorCode();\n        }\n        try {\n            /** @var \\Passbolt\\DirectorySync\\Model\\Table\\DirectoryIgnoreTable $DirectoryIgnore */\n            $DirectoryIgnore = TableRegistry::getTableLocator()->get('Passbolt/DirectorySync.DirectoryIgnore');\n            $ignored = $DirectoryIgnore->get($foreignKey);\n            if ($ignored->foreign_model !== $foreignModel) {\n                throw new RecordNotFoundException(__('The record could not be found.'));\n            }\n            $DirectoryIgnore->delete($ignored);\n            $this->success(__('The record will stop being ignored in the next directory synchronization.'), $io);\n\n            return $this->successCode();\n        } catch (RecordNotFoundException $exception) {\n            $io->err($exception->getMessage());\n\n            return $this->successCode();\n        }\n    }\n}\n","sourceCodeStart":48,"sourceCodeEnd":79,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/DirectorySync/src/Command/IgnoreDeleteCommand.php#L48-L79","documentation":"RecordNotFoundException thrown by IgnoreDeleteCommand::execute when the given foreignKey has no matching row in the directory_ignore table, or the row exists but its foreign_model does not match the requested model. The command is meant to remove a previously ignored entry (user/group/directory entry) so it participates in the next sync; if there is nothing to un-ignore, the table get() or the explicit model check raises this error, and the catch block converts it to a command failure.","triggerScenarios":"Running `passbolt passbolt directory_sync ignore-delete <foreignModel> <foreignKey>` where (1) the foreignKey UUID was never ignored, (2) it was already un-ignored, or (3) it exists in directory_ignore under a different foreign_model (e.g. stored as Users but deleted as Groups).","commonSituations":"Operator scripting cleanup of ignore records after re-running sync twice (second run fails because the first already deleted the record); passing a User UUID to ignore-delete Groups; typo'd or truncated UUID argument.","solutions":["List existing ignore records first (query directory_ignore table or run the ignore-list equivalent) and use an exact foreignModel + foreignKey pair that exists.","Check the row's foreign_model column matches the command argument: SELECT foreign_model, foreign_key FROM directory_ignore WHERE foreign_key = '<uuid>';","If the record was already deleted, treat the command as a no-op and skip it in scripts (idempotent cleanup)."],"exampleFix":"// before\nbin/cake passbolt directory_sync ignore-delete Groups 3f1c... (row stored as Users)\n// after\nbin/cake passbolt directory_sync ignore-delete Users 3f1c...","handlingStrategy":"validation","validationCode":"$exists = TableRegistry::getTableLocator()->get('Passbolt/DirectorySync.DirectoryIgnore')\n    ->exists(['foreign_key' => $foreignKey, 'foreign_model' => $foreignModel]);\nif (!$exists) { /* skip: nothing to un-ignore */ }","typeGuard":null,"tryCatchPattern":"try {\n    $cmd->execute($io, $foreignModel, $foreignKey);\n} catch (RecordNotFoundException $e) {\n    // treat as already-deleted: proceed idempotently\n}","preventionTips":["Query directory_ignore for the exact (foreign_model, foreign_key) pair before invoking the command.","Make cleanup scripts idempotent — expect and tolerate record-not-found on repeat runs.","Copy foreign_model values exactly from the table rather than from memory."],"tags":["directory-sync","cli","record-not-found","ignore-list"],"backgroundTag":"record-not-found","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"}