{"record":{"id":"2121e78a471414d0","repo":"passbolt/passbolt_api","slug":"the-resource-type-s-has-not-map-for-scim-entry-model","errorCode":null,"errorMessage":"The resource type `%s` has not map for scim entry model","messagePattern":"The resource type `(.+?)` has not map for scim entry model","errorType":"exception","errorClass":"Cake\\Http\\Exception\\BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Scim/src/Utility/Object/ListResponse.php","lineNumber":90,"sourceCode":"     *\n     * @param string $resourceType\n     * @param int|null $startIndex\n     * @param int|null $count\n     * @param string|null $filter\n     * @return $this\n     * @throws \\Exception\n     */\n    public function fetchResources(\n        string $resourceType,\n        ?int $startIndex = null,\n        ?int $count = null,\n        ?string $filter = null,\n    ) {\n        if (!ScimResources::isValid($resourceType)) {\n            throw new BadRequestException(sprintf('The resource type `%s` is not valid', $resourceType));\n        }\n        if (!isset(ScimEntry::MODEL_MAP[$resourceType])) {\n            throw new BadRequestException(\n                sprintf('The resource type `%s` has not map for scim entry model', $resourceType)\n            );\n        }\n\n        if ($startIndex !== null && $startIndex > 0) {\n            $this->startIndex = $startIndex;\n        }\n        if ($count !== null && $count > 0) {\n            $this->itemsPerPage = $count;\n        }\n\n        /** @var \\Passbolt\\Scim\\Model\\Table\\ScimEntriesTable $scimEntriesTable */\n        $scimEntriesTable = $this->fetchTable('Passbolt/Scim.ScimEntries');\n        $conditions = [\n            $scimEntriesTable->aliasField('foreign_model') => ScimEntry::MODEL_MAP[$resourceType],\n        ];\n        if ($filter !== null) {\n            //@todo: tmilos/scim-filter-parser should be used if more filters are needed","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Scim/src/Utility/Object/ListResponse.php#L72-L108","documentation":"After ScimResources::isValid() passes, fetchResources() additionally requires an entry in ScimEntry::MODEL_MAP so the resource type can be resolved to a foreign model ('users'/'groups'). A type that passes validity but lacks a mapping indicates an internal inconsistency (a registered SCIM resource type without a database-backed entry model) and throws BadRequestException. With the current MODEL_MAP (Users/Groups only) this is effectively dead defensive code, but it guards future additions.","triggerScenarios":"GET /scim/v2/<type> where <type> is recognized by ScimResources but absent from ScimEntry::MODEL_MAP — only possible if ScimResources is extended (e.g. a new const like SCIM_RESOURCES_EMAILS added to isValid() without a MODEL_MAP entry).","commonSituations":"Custom development extending the SCIM plugin with new resource types; a plugin version mismatch where ScimResources knows a type the entry model map doesn't (mixed plugin/core versions after partial deploy).","solutions":["Add a mapping in ScimEntry::MODEL_MAP for the new resource type, pointing to its foreign model constant.","Ensure plugin versions are consistent — redeploy the full PassboltEe/Scim plugin so ScimResources and ScimEntry agree.","If the type isn't intended to be supported, fix the caller to use only Users/Groups."],"exampleFix":"// before (ScimEntry.php)\npublic const MODEL_MAP = [\n    ScimResources::USERS => self::FOREIGN_MODEL_USERS,\n];\n// after\npublic const MODEL_MAP = [\n    ScimResources::USERS => self::FOREIGN_MODEL_USERS,\n    ScimResources::GROUPS => self::FOREIGN_MODEL_GROUPS,\n];","handlingStrategy":"try-catch","validationCode":"if (!Object.keys(ScimEntry::MODEL_MAP).contains($resourceType)) { /* reject before calling */ }","typeGuard":null,"tryCatchPattern":"try {\n  $response = (new ListResponse())->fetchResources($resourceType);\n} catch (BadRequestException $e) {\n  Log::error('SCIM resource type lacks MODEL_MAP entry: ' . $resourceType);\n}","preventionTips":["When adding a ScimResources constant, always add the matching ScimEntry::MODEL_MAP entry in the same change.","Keep plugin and core deployments in lockstep to avoid map/version drift.","Add a unit test iterating ScimResources types against MODEL_MAP."],"tags":["scim","php","internal-invariant","mapping"],"backgroundTag":"internal-invariant-violation","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"}