{"record":{"id":"6ca8b2ad9304df60","repo":"passbolt/passbolt_api","slug":"the-record-does-not-exist","errorCode":null,"errorMessage":"The record does not exist.","messagePattern":"The record does not exist\\.","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"info","filePath":"plugins/PassboltEe/DirectorySync/src/Controller/DirectoryIgnoreController.php","lineNumber":165,"sourceCode":"     */\n    public function delete(string $foreignModel, string $foreignKey): void\n    {\n        if ($this->User->role() !== Role::ADMIN) {\n            throw new ForbiddenException(__('You are not authorized to access that location.'));\n        }\n        $this->assertDirectoryEnabled();\n        if (!Validation::uuid($foreignKey)) {\n            throw new BadRequestException(__('The record id is not valid.'));\n        }\n        $foreignModel = $this->normalizeForeignModel($foreignModel);\n        if (!Validation::inList($foreignModel, ['Groups', 'Users', 'DirectoryEntries'])) {\n            throw new BadRequestException(__('The record model is not valid.'));\n        }\n\n        try {\n            $record = $this->DirectoryIgnore->get($foreignKey);\n        } catch (RecordNotFoundException $e) {\n            throw new NotFoundException(__('The record does not exist.'));\n        }\n\n        $result = $this->DirectoryIgnore->delete($record);\n        if (!$result) {\n            $msg = __('The record could not be unmarked as ignored. Please try again later.');\n            throw new InternalErrorException($msg);\n        }\n        $this->success(__('The record will not be ignored in the next directory synchronization.'));\n    }\n\n    /**\n     * @param string $foreignModel foreign model\n     * @return string\n     */\n    private function normalizeForeignModel(string $foreignModel): string\n    {\n        $foreignModel = ucfirst($foreignModel);\n        if ($foreignModel === 'Directoryentries') {","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/DirectorySync/src/Controller/DirectoryIgnoreController.php#L147-L183","documentation":"This NotFoundException (HTTP 404) is thrown in delete() when DirectoryIgnore->get($foreignKey) raises RecordNotFoundException, meaning there is no ignore entry for that record — it is simply not ignored, so there is nothing to un-ignore. The controller converts the table-layer record-not-found into a 404.","triggerScenarios":"DELETE /directoryignore/users/{valid-uuid} where no directory_ignore row exists for that uuid (never ignored, or already un-ignored by another admin).","commonSituations":"Double-click / duplicate DELETE requests; reconciling a stale local list of ignored records; concurrent admins editing the ignore list.","solutions":["Treat 404 as idempotent success — the goal state (not ignored) is already reached","Only delete records that appear in the current ignore listing","Avoid duplicate DELETE calls for the same uuid in retries","Refresh the ignore list before re-running cleanup scripts"],"exampleFix":"// before: blind DELETE fails on second run\n$api->deleteIgnore($model, $id); // 404\n// after: idempotent handling\ntry { $api->deleteIgnore($model, $id); }\ncatch (NotFoundException $e) { /* already un-ignored */ }","handlingStrategy":"try-catch","validationCode":"$ignored = array_filter($api->get('/directoryignore.json')['ignoredRecords'] ?? [],\n    fn($r) => $r['foreign_key'] === $id);\nif (!$ignored) { return; // nothing to un-ignore\n}","typeGuard":null,"tryCatchPattern":"try {\n    $api->delete(\"/directoryignore/{$model}/{$id}.json\");\n} catch (NotFoundException $e) {\n    // 404: entry already absent — treat as idempotent success\n}","preventionTips":["Make DELETE idempotent in client wrappers (ignore 404)","Refresh ignore lists before batch un-ignore runs","Guard against duplicate/concurrent delete calls"],"tags":["not-found","directory-sync","idempotency","ignore-list"],"backgroundTag":"resource-not-found","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}