passbolt/passbolt_api · info · NotFoundException

The record does not exist.

Error message

The record does not exist.

What it means

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.

Solutions

  1. Treat 404 as idempotent success — the goal state (not ignored) is already reached
  2. Only delete records that appear in the current ignore listing
  3. Avoid duplicate DELETE calls for the same uuid in retries
  4. Refresh the ignore list before re-running cleanup scripts

Example fix

// before: blind DELETE fails on second run
$api->deleteIgnore($model, $id); // 404
// after: idempotent handling
try { $api->deleteIgnore($model, $id); }
catch (NotFoundException $e) { /* already un-ignored */ }
Defensive patterns

Strategy: try-catch

Validate before calling

$ignored = array_filter($api->get('/directoryignore.json')['ignoredRecords'] ?? [],
    fn($r) => $r['foreign_key'] === $id);
if (!$ignored) { return; // nothing to un-ignore
}

Try / catch

try {
    $api->delete("/directoryignore/{$model}/{$id}.json");
} catch (NotFoundException $e) {
    // 404: entry already absent — treat as idempotent success
}

Prevention

When it happens

Trigger: DELETE /directoryignore/users/{valid-uuid} where no directory_ignore row exists for that uuid (never ignored, or already un-ignored by another admin).

Common situations: Double-click / duplicate DELETE requests; reconciling a stale local list of ignored records; concurrent admins editing the ignore list.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/6ca8b2ad9304df60. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltEe/DirectorySync/src/Controller/DirectoryIgnoreController.php:165

     */
    public function delete(string $foreignModel, string $foreignKey): void
    {
        if ($this->User->role() !== Role::ADMIN) {
            throw new ForbiddenException(__('You are not authorized to access that location.'));
        }
        $this->assertDirectoryEnabled();
        if (!Validation::uuid($foreignKey)) {
            throw new BadRequestException(__('The record id is not valid.'));
        }
        $foreignModel = $this->normalizeForeignModel($foreignModel);
        if (!Validation::inList($foreignModel, ['Groups', 'Users', 'DirectoryEntries'])) {
            throw new BadRequestException(__('The record model is not valid.'));
        }

        try {
            $record = $this->DirectoryIgnore->get($foreignKey);
        } catch (RecordNotFoundException $e) {
            throw new NotFoundException(__('The record does not exist.'));
        }

        $result = $this->DirectoryIgnore->delete($record);
        if (!$result) {
            $msg = __('The record could not be unmarked as ignored. Please try again later.');
            throw new InternalErrorException($msg);
        }
        $this->success(__('The record will not be ignored in the next directory synchronization.'));
    }

    /**
     * @param string $foreignModel foreign model
     * @return string
     */
    private function normalizeForeignModel(string $foreignModel): string
    {
        $foreignModel = ucfirst($foreignModel);
        if ($foreignModel === 'Directoryentries') {

View on GitHub (pinned to 31c1bbc10f)