passbolt/passbolt_api · error · Cake\Http\Exception\NotFoundException

The SCIM setting does not exist.

Error message

The SCIM setting does not exist.

What it means

This NotFoundException is thrown by ScimDeleteSettingsService::deleteSettings() when no SCIM setting matching the given id can be deleted. The service fetches the single SCIM settings row (only one configuration is supported) and requires that the provided id exactly equals its id; if the table is empty or the ids differ, it throws before attempting the delete. Callers are execute() and the delete workflow of the settings controller.

Solutions

  1. Fetch the current SCIM settings (GET the settings endpoint) and use the id field from the response as the deletion id
  2. Check whether SCIM settings exist at all before calling delete - if none exist, treat the setting as already absent rather than retrying
  3. Make delete operations idempotent in your integration: catch the NotFoundException (HTTP 404) and consider the resource already removed
  4. If you believe a setting exists, verify the scim_settings table contents (bin/cake or DB query) and confirm you are pointing at the intended environment/database

Example fix

// before (deleting with a hardcoded/guessed id)
await api.delete('/scim/v2/' + settingId + '.json');

// after (fetch the live id first, tolerate 404)
const settings = await api.get('/scim/v2/settingId.json');
if (settings.body.id === settingId) {
  await api.delete('/scim/v2/' + settingId + '.json');
}
Defensive patterns

Strategy: validation

Validate before calling

const settings = await api.get('/scim/v2/settingId.json');
if (!settings.body || settings.body.id !== targetId) {
  console.warn('No SCIM setting with id', targetId, '- skipping delete');
  return;
}

Type guard

function settingExists(settings: { id: string } | null, id: string): settings is { id: string } {
  return settings !== null && settings.id === id;
}

Try / catch

try {
  await api.delete(`/scim/v2/${id}.json`);
} catch (e) {
  if (e.status === 404) return; // treat as already deleted (idempotent)
  throw e;
}

Prevention

When it happens

Trigger: DELETE /scim/v2/settingId.json (settings deletion endpoint) with an id that does not match the stored settings row: no SCIM settings have been created yet, the client is using a stale or wrong setting id (e.g. an id from another environment), or the setting was already deleted by a concurrent request so a second delete finds nothing.

Common situations: Double-invoking a delete (retry after a first success); copy-pasting a settingId from documentation or a staging instance into a production request; deleting SCIM settings before ever creating them; the SCIM plugin installed but never configured.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at plugins/PassboltEe/Scim/src/Service/ScimDeleteSettingsService.php:45

    use LocatorAwareTrait;

    /**
     * Delete the SCIM settings in the DB
     * If not found, return a NotFoundException
     *
     * @param \App\Utility\UserAccessControl $uac User access control
     * @param string $id ID of the setting to delete
     * @return bool
     * @throws \Cake\Http\Exception\NotFoundException if no SCIM settings were found for the provided ID
     */
    public function deleteSettings(UserAccessControl $uac, string $id): bool
    {
        /** @var \Passbolt\Scim\Model\Table\ScimSettingsTable $scimSettingsTable */
        $scimSettingsTable = $this->fetchTable('Passbolt/Scim.ScimSettings');
        /** @var \Passbolt\Scim\Model\Entity\ScimSetting|null $settings */
        $settings = $scimSettingsTable->find()->first();
        if (is_null($settings) || $settings->get('id') !== $id) {
            throw new NotFoundException('The SCIM setting does not exist.');
        }

        $result = $scimSettingsTable->deleteOrFail($settings);
        $eventData = [
            'modified_by' => $uac->getId(),
        ];

        $this->dispatchEvent(
            ScimSetSettingsService::SCIM_SETTINGS_UPDATE_EVENT_NAME,
            $eventData
        );

        return $result;
    }
}

View on GitHub (pinned to 31c1bbc10f)