{"record":{"id":"8e9e583d54694807","repo":"elsa-workflows/elsa-core","slug":"the-upstream-logout-mode-is-not-supported","errorCode":null,"errorMessage":"The upstream logout mode is not supported.","messagePattern":"The upstream logout mode is not supported\\.","errorType":"validation","errorClass":"JsonException","httpStatus":400,"severity":"error","filePath":"src/modules/Elsa.ExternalAuthentication/Endpoints/Connections/ConnectionManagementModels.cs","lineNumber":198,"sourceCode":"                    observation.Summary)\n        };\n    }\n\n}\n\ninternal sealed class UpstreamLogoutModeJsonConverter : JsonConverter<UpstreamLogoutMode>\n{\n    public override UpstreamLogoutMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)\n    {\n        if (reader.TokenType != JsonTokenType.String)\n            throw new JsonException(\"The upstream logout mode must be a string.\");\n\n        return reader.GetString()?.ToLowerInvariant() switch\n        {\n            \"disabled\" => UpstreamLogoutMode.Disabled,\n            \"userchoice\" or \"user-choice\" or \"user_choice\" => UpstreamLogoutMode.UserChoice,\n            \"always\" => UpstreamLogoutMode.Always,\n            _ => throw new JsonException(\"The upstream logout mode is not supported.\")\n        };\n    }\n\n    public override void Write(Utf8JsonWriter writer, UpstreamLogoutMode value, JsonSerializerOptions options) =>\n        writer.WriteStringValue(value switch\n        {\n            UpstreamLogoutMode.Disabled => \"disabled\",\n            UpstreamLogoutMode.UserChoice => \"user-choice\",\n            UpstreamLogoutMode.Always => \"always\",\n            _ => throw new JsonException(\"The upstream logout mode is not supported.\")\n        });\n}\n\ninternal sealed record ConnectionReferenceResponse(string Id, string DisplayName, string Source)\n{\n    public static ConnectionReferenceResponse From(IdentityProviderConnectionReference reference) =>\n        new(\n            reference.Id,","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.ExternalAuthentication/Endpoints/Connections/ConnectionManagementModels.cs#L180-L216","documentation":"Thrown by UpstreamLogoutModeJsonConverter.Read when the JSON string does not match any known upstream logout mode (disabled, userchoice/user-choice/user_choice, always). The converter lowercases the input before matching, so only misspellings or genuinely unknown values fail here.","triggerScenarios":"Deserializing a connection payload whose upstream logout mode string is not one of the accepted literals after lowercasing, e.g. \"LogoutAlways\" is fine but \"default\" or \"signout\" fails.","commonSituations":"Typos in configuration or API payloads; newer/older client versions using a mode name this converter does not recognize; copying values from a different product's enum.","solutions":["Use one of the accepted values: \"disabled\", \"user-choice\" (or \"userchoice\"/\"user_choice\"), or \"always\".","Verify against the current API docs that the mode name exists; casing is case-insensitive.","If a new mode is genuinely needed, extend the converter's switch and the enum, then redeploy."],"exampleFix":"// before\n{\"upstreamLogoutMode\": \"automatic\"}\n// after\n{\"upstreamLogoutMode\": \"always\"}","handlingStrategy":"validation","validationCode":"var allowed = new[]{\"disabled\",\"userchoice\",\"user-choice\",\"user_choice\",\"always\"};\nif (!allowed.Contains(raw?.ToLowerInvariant())) throw new ArgumentException($\"Unsupported upstream logout mode: {raw}\");","typeGuard":"bool IsKnownLogoutMode(string? s) => s is not null && new[]{\"disabled\",\"userchoice\",\"user-choice\",\"user_choice\",\"always\"}.Contains(s.ToLowerInvariant());","tryCatchPattern":"try { result = Deserialize(json); }\ncatch (JsonException ex) when (ex.Message == \"The upstream logout mode is not supported.\")\n{ /* surface allowed values to caller */ }","preventionTips":["Copy mode literals from the API docs, not memory","Lowercase-insensitive checks are already applied — focus on spelling","Keep a shared enum/constants type between client and server"],"tags":["json","serialization","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}