{"record":{"id":"cff48c5fc7ae2739","repo":"passbolt/passbolt_api","slug":"the-scim-setting-does-not-exist","errorCode":null,"errorMessage":"The SCIM setting does not exist.","messagePattern":"The SCIM setting does not exist\\.","errorType":"exception","errorClass":"Cake\\Http\\Exception\\NotFoundException","httpStatus":404,"severity":"error","filePath":"plugins/PassboltEe/Scim/src/Service/ScimDeleteSettingsService.php","lineNumber":45,"sourceCode":"    use LocatorAwareTrait;\n\n    /**\n     * Delete the SCIM settings in the DB\n     * If not found, return a NotFoundException\n     *\n     * @param \\App\\Utility\\UserAccessControl $uac User access control\n     * @param string $id ID of the setting to delete\n     * @return bool\n     * @throws \\Cake\\Http\\Exception\\NotFoundException if no SCIM settings were found for the provided ID\n     */\n    public function deleteSettings(UserAccessControl $uac, string $id): bool\n    {\n        /** @var \\Passbolt\\Scim\\Model\\Table\\ScimSettingsTable $scimSettingsTable */\n        $scimSettingsTable = $this->fetchTable('Passbolt/Scim.ScimSettings');\n        /** @var \\Passbolt\\Scim\\Model\\Entity\\ScimSetting|null $settings */\n        $settings = $scimSettingsTable->find()->first();\n        if (is_null($settings) || $settings->get('id') !== $id) {\n            throw new NotFoundException('The SCIM setting does not exist.');\n        }\n\n        $result = $scimSettingsTable->deleteOrFail($settings);\n        $eventData = [\n            'modified_by' => $uac->getId(),\n        ];\n\n        $this->dispatchEvent(\n            ScimSetSettingsService::SCIM_SETTINGS_UPDATE_EVENT_NAME,\n            $eventData\n        );\n\n        return $result;\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":61,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Scim/src/Service/ScimDeleteSettingsService.php#L27-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fetch the current SCIM settings (GET the settings endpoint) and use the id field from the response as the deletion id","Check whether SCIM settings exist at all before calling delete - if none exist, treat the setting as already absent rather than retrying","Make delete operations idempotent in your integration: catch the NotFoundException (HTTP 404) and consider the resource already removed","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"],"exampleFix":"// before (deleting with a hardcoded/guessed id)\nawait api.delete('/scim/v2/' + settingId + '.json');\n\n// after (fetch the live id first, tolerate 404)\nconst settings = await api.get('/scim/v2/settingId.json');\nif (settings.body.id === settingId) {\n  await api.delete('/scim/v2/' + settingId + '.json');\n}","handlingStrategy":"validation","validationCode":"const settings = await api.get('/scim/v2/settingId.json');\nif (!settings.body || settings.body.id !== targetId) {\n  console.warn('No SCIM setting with id', targetId, '- skipping delete');\n  return;\n}","typeGuard":"function settingExists(settings: { id: string } | null, id: string): settings is { id: string } {\n  return settings !== null && settings.id === id;\n}","tryCatchPattern":"try {\n  await api.delete(`/scim/v2/${id}.json`);\n} catch (e) {\n  if (e.status === 404) return; // treat as already deleted (idempotent)\n  throw e;\n}","preventionTips":["Always obtain the setting id from a live GET of the settings endpoint, never hardcode it","Make SCIM setting deletes idempotent by tolerating 404s","Confirm the environment (staging vs production) before deleting settings","Avoid concurrent delete workflows racing on the single SCIM settings row"],"tags":["scim","rest","not-found","delete","http"],"backgroundTag":"entity-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"}