{"record":{"id":"f68a95f11927d765","repo":"passbolt/passbolt_api","slug":"could-not-ignore-the-record-please-try-again-later","errorCode":null,"errorMessage":"Could not ignore the record, please try again later.","messagePattern":"Could not ignore the record, please try again later\\.","errorType":"http","errorClass":"InternalErrorException","httpStatus":500,"severity":"critical","filePath":"plugins/PassboltEe/DirectorySync/src/Model/Table/DirectoryIgnoreTable.php","lineNumber":217,"sourceCode":"            [\n                'id' => $foreignKey,\n                'foreign_model' => $foreignModel,\n            ],\n            [\n                'accessibleFields' => [\n                    'id' => true,\n                    'foreign_model' => true,\n                ]]\n        );\n        if ($ignore->getErrors()) {\n            throw new ValidationException(__('This is not a valid record to ignore.'), $ignore, $this);\n        }\n        $this->checkRules($ignore);\n        if ($ignore->getErrors()) {\n            throw new ValidationException(__('This is not a valid record to ignore.'), $ignore, $this);\n        }\n        if (!$this->save($ignore, ['checkrules' => false])) {\n            throw new InternalErrorException('Could not ignore the record, please try again later.');\n        }\n\n        return $ignore;\n    }\n\n    /**\n     * Delete all association records where associated users entities are deleted\n     *\n     * @param string $entityType Users or Groups\n     * @param bool $dryRun false\n     * @return int number of affected records\n     */\n    public function cleanupHardDeletedEntities(string $entityType, ?bool $dryRun = false): int\n    {\n        $query = $this->selectQuery()\n            ->select(['id'])\n            ->leftJoinWith($entityType)\n            ->where(function ($exp, $q) use ($entityType) {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/DirectorySync/src/Model/Table/DirectoryIgnoreTable.php#L199-L235","documentation":"Thrown when the final $this->save() of the new DirectoryIgnore entity returns false despite validation and rules passing. This is an InternalErrorException: an unexpected persistence failure, not a client mistake — passbolt asks the caller to retry later.","triggerScenarios":"save() failing due to database-level issues: connection failure, lock timeout, a duplicate primary key inserted concurrently between the initial existence check and the save, or a database constraint violation not caught by validation.","commonSituations":"Two concurrent ignore requests for the same record (race on the existence check then duplicate PK on insert); MySQL/Postgres outage or replication lag; database in read-only mode; disk full on the DB server.","solutions":["Retry the request after a short delay, as the message suggests.","Check database connectivity/health and server logs for the underlying SQL error.","For the concurrency race, use createOrFail inside a transaction with try/catch and treat 'duplicate key' as already-ignored success, or check existence atomically.","Verify the DB user has INSERT privileges on the directory_ignore table."],"exampleFix":"// before\n$ignore = $this->DirectoryIgnore->createOrFail('User', $userId);\n// after\ntry {\n    $ignore = $this->DirectoryIgnore->createOrFail('User', $userId);\n} catch (InternalErrorException $e) {\n    // retry once or surface 500 with correlation id\n}","handlingStrategy":"retry","validationCode":"$dbUp = $this->DirectoryIgnore->getConnection()->isConnected(); // plus a cheap SELECT 1 health probe before batch operations","typeGuard":null,"tryCatchPattern":"try {\n    $ignore = $this->DirectoryIgnore->createOrFail('User', $userId);\n} catch (Cake\\Http\\Exception\\InternalErrorException $e) {\n    // retry with backoff; on repeated failure check DB health and server logs\n}","preventionTips":["Wrap ignore operations in a transaction to close the check-then-insert race","Treat duplicate-key errors on retry as already-ignored success","Monitor DB connectivity, disk space, and read-only state before sync jobs","Retry transient save failures with exponential backoff"],"tags":["passbolt","directory-sync","database","save-failed","http-500"],"backgroundTag":"database-write-failed","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"}