{"record":{"id":"35f5443b67b7da5e","repo":"bitwarden/server","slug":"unknown-organization-connection-type-type","errorCode":null,"errorMessage":"Unknown Organization connection Type: {type}","messagePattern":"Unknown Organization connection Type: (.+?)","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/AdminConsole/Controllers/OrganizationConnectionsController.cs","lineNumber":140,"sourceCode":"        {\n            throw new BadRequestException($\"You do not have permission to retrieve a connection of type {type}.\");\n        }\n\n        var connections = await GetConnectionsAsync(organizationId, type);\n        var connection = connections.FirstOrDefault(c => c.Type == type);\n\n        switch (type)\n        {\n            case OrganizationConnectionType.CloudBillingSync:\n                if (!_globalSettings.SelfHosted)\n                {\n                    throw new BadRequestException($\"Cannot get a {type} connection outside of a self-hosted instance.\");\n                }\n                return new OrganizationConnectionResponseModel(connection, typeof(BillingSyncConfig));\n            case OrganizationConnectionType.Scim:\n                return new OrganizationConnectionResponseModel(connection, typeof(ScimConfig));\n            default:\n                throw new BadRequestException($\"Unknown Organization connection Type: {type}\");\n        }\n    }\n\n    [HttpDelete(\"{organizationConnectionId}\")]\n    public async Task DeleteConnection(Guid organizationConnectionId)\n    {\n        var connection = await _organizationConnectionRepository.GetByIdAsync(organizationConnectionId);\n\n        if (connection == null)\n        {\n            throw new NotFoundException();\n        }\n\n        if (!await HasPermissionAsync(connection.OrganizationId, connection.Type))\n        {\n            throw new BadRequestException($\"You do not have permission to remove this connection of type {connection.Type}.\");\n        }\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/AdminConsole/Controllers/OrganizationConnectionsController.cs#L122-L158","documentation":"Thrown by the default case of the type switch in GetConnection (GET /organizations/connections/{organizationId}/{type}) when the route type is neither CloudBillingSync(1) nor Scim(2). The type comes from the route segment which binds to the OrganizationConnectionType enum; out-of-range integers reach the default branch. Maps to HTTP 400.","triggerScenarios":"GET /organizations/connections/{orgId}/{type} with type = 0, 3, or any integer outside {1,2} in the route.","commonSituations":"Client/server version skew; a hand-typed URL with a wrong segment; an integration test using an arbitrary enum value.","solutions":["Use type = 1 (CloudBillingSync) or 2 (Scim) in the route.","If a newer type was expected, deploy a server version that defines it.","Validate the type segment client-side before issuing the GET.","Check for integer-vs-name routing mismatches."],"exampleFix":"// before\nGET /organizations/connections/{orgId}/0\n// after\nGET /organizations/connections/{orgId}/2","handlingStrategy":"type-guard","validationCode":"if (!Enum.IsDefined(typeof(OrganizationConnectionType), type) ||\n    type is not (OrganizationConnectionType.CloudBillingSync or OrganizationConnectionType.Scim))\n    throw new ArgumentOutOfRangeException(nameof(type), \"Type must be 1 (CloudBillingSync) or 2 (Scim).\");","typeGuard":"static bool IsKnownConnectionType(OrganizationConnectionType t) =>\n    t is OrganizationConnectionType.CloudBillingSync or OrganizationConnectionType.Scim;","tryCatchPattern":null,"preventionTips":["Validate the route type segment before issuing the GET.","Use named enum values, not magic integers, in URLs.","Keep client/server enum versions aligned."],"tags":["enum","organization-connections","validation","http-400"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}