{"record":{"id":"28121f8d0ce5e35c","repo":"passbolt/passbolt_api","slug":"service-provider-invalid","errorCode":null,"errorMessage":"Service provider invalid.","messagePattern":"Service provider invalid\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php","lineNumber":154,"sourceCode":"                $msg .= $exception->getMessage();\n                throw new InternalErrorException($msg, 500, $exception);\n            }\n        }\n\n        return $gpg->encrypt($jsonData, true);\n    }\n\n    /**\n     * @param array $data payload\n     * @return \\Passbolt\\Sso\\Form\\BaseSsoSettingsForm\n     */\n    protected function getSsoSettingsForm(array $data): BaseSsoSettingsForm\n    {\n        if (!isset($data['provider'])) {\n            throw new BadRequestException('Service provider missing.');\n        }\n        if (!is_string($data['provider'])) {\n            throw new BadRequestException('Service provider invalid.');\n        }\n        if (!in_array($data['provider'], SsoSetting::ALLOWED_PROVIDERS)) {\n            throw new BadRequestException('Service provider not supported.');\n        }\n\n        switch ($data['provider']) {\n            case SsoSetting::PROVIDER_AZURE:\n                return new SsoSettingsAzureDataForm();\n            case SsoSetting::PROVIDER_GOOGLE:\n                return new SsoSettingsGoogleDataForm();\n            case SsoSetting::PROVIDER_OAUTH2:\n                return new SsoSettingsOAuth2DataForm();\n            case SsoSetting::PROVIDER_ADFS:\n                return new SsoSettingsAdfsDataForm();\n            case SsoSetting::PROVIDER_PINGONE:\n                return new SsoSettingsPingOneDataForm();\n            default:\n                throw new BadRequestException('Service provider not supported.');","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php#L136-L172","documentation":"Thrown by SsoSettingsSetService::getSsoSettingsForm when the 'provider' field is present but is not a string (e.g. an array, integer, or null-like value). The provider must be a string identifier to look up the correct form class.","triggerScenarios":"POST/PUT /sso/settings with provider set to a non-string value, e.g. {\"provider\": 123} or {\"provider\": {\"name\": \"azure\"}}.","commonSituations":"Client code passing an enum/number instead of its string name; JSON payload built programmatically with wrong types; form submissions sending provider as an array.","solutions":["Send provider as a plain string, e.g. \"provider\": \"azure\".","Check the client serialization so the provider value is not wrapped in an object/array.","Cast/normalize on the client side before sending (String(provider))."],"exampleFix":"// before\n\"provider\": { \"id\": \"azure\" }\n// after\n\"provider\": \"azure\"","handlingStrategy":"type-guard","validationCode":"if (isset($payload['provider']) && !is_string($payload['provider'])) { throw new \\TypeError('provider must be a string'); }","typeGuard":"function isStringProvider($p): bool { return is_string($p) && $p !== ''; }","tryCatchPattern":null,"preventionTips":["Send provider as a JSON string, never a number or object.","Avoid PHP loose-typing surprises in client code (declare strict_types).","Test payload serialization before calling the API."],"tags":["php","sso","bad-request","type-error"],"backgroundTag":"type-mismatch","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"}