{"record":{"id":"17607a285966ac15","repo":"passbolt/passbolt_api","slug":"the-mutability-s-is-invalid-or-not-supported","errorCode":null,"errorMessage":"The mutability `%s` is invalid or not supported","messagePattern":"The mutability `(.+?)` is invalid or not supported","errorType":"exception","errorClass":"Passbolt\\Scim\\Exception\\ScimException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Scim/src/Utility/Resource/UserScimResource.php","lineNumber":521,"sourceCode":"                $attribute = Hash::extract($nameAttribute, \"subAttributes.{n}[name=$subAttributeName]\");\n                $mutability = $attribute[0]['mutability'] ?? null;\n                break;\n            case 'active':\n                $attribute = Hash::extract($userSchema, 'attributes.{n}[name=active]');\n                $mutability = $attribute[0]['mutability'] ?? null;\n                break;\n            case 'emails':\n                $emailsAttribute = Hash::extract($userSchema, 'attributes.{n}[name=emails]')[0] ?? [];\n                $attribute = Hash::extract($emailsAttribute, 'subAttributes.{n}[name=value]');\n                $mutability = $attribute[0]['mutability'] ?? null;\n                break;\n            default:\n                // set no used attributes as ATTRIBUTE_MUTABILITY_READ_WRITE to not trigger an error\n                // this attributes will not be processed further int he process\n                $mutability = ScimConstants::ATTRIBUTE_MUTABILITY_READ_WRITE;\n        }\n        if (!ScimConstants::isValidAttributeMutability((string)$mutability)) {\n            throw new ScimException(sprintf('The mutability `%s` is invalid or not supported', $mutability));\n        }\n\n        return $mutability;\n    }\n\n    /**\n     * {@inheritDoc}\n     *\n     * @throws \\Exception\n     */\n    public function patch(PatchRequest $patchRequest): static\n    {\n        $serviceConfig = new ServiceProviderConfig();\n        if (!$serviceConfig->isPatchSupported()) {\n            throw new NotSupportedException('The PATCH operation is not supported');\n        }\n        if (!$this->userEntity) {\n            throw new ScimException('The database user must be set to apply an operation');","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Scim/src/Utility/Resource/UserScimResource.php#L503-L539","documentation":"This ScimException is thrown by getAttributeMutability() when the mutability value extracted from the core user SCIM schema is not one of the valid SCIM mutability constants (readOnly/readWrite/immutable/writeOnly). It guards against a corrupted or unexpected schema definition.","triggerScenarios":"PATCH /scim/v2/Users/{id} processing an attribute (name.givenName, name.familyName, active, emails) whose mutability extracted from the generated schema is null or an unrecognized string.","commonSituations":"Schema files/plugin version mismatch (schema built by Schemas::build returns unexpected structure), Hash::extract path failing after a schema refactor leaving mutability null, or customized/overridden SCIM schema constants.","solutions":["Verify ScimConstants::isValidAttributeMutability and the CORE_USER schema contain correct mutability values","Clear cache and ensure the Scim plugin version matches the schema definitions (composer install/update)","Inspect Schemas::build(SchemaIdentifier::CORE_USER)->toSCIM() output to confirm attributes expose a valid 'mutability' key"],"exampleFix":"// before (schema attribute missing mutability)\n{\"name\":\"active\",\"type\":\"boolean\"}\n// after\n{\"name\":\"active\",\"type\":\"boolean\",\"mutability\":\"readWrite\"}","handlingStrategy":"try-catch","validationCode":"$mutability = $schemaAttribute['mutability'] ?? null;\n$valid = ['readOnly', 'readWrite', 'immutable', 'writeOnly'];\nif (!in_array($mutability, $valid, true)) {\n    // fail fast before sending PATCH\n    throw new RuntimeException(\"Attribute mutability '$mutability' is not valid SCIM.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $scimUsers->patch($id, $patchRequest);\n} catch (\\Passbolt\\Scim\\Exception\\ScimException $e) {\n    if (str_contains($e->getMessage(), 'mutability')) {\n        // schema/plugin mismatch: update plugin, clear cache, re-fetch schema\n    }\n}","preventionTips":["Keep the Scim plugin and schema definitions at matching versions (composer update)","Clear application cache after plugin/schema upgrades","Add a unit test asserting every CORE_USER schema attribute exposes a valid mutability"],"tags":["scim","schema","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}