{"record":{"id":"6eb55b14a0e1158a","repo":"oauth2-proxy/oauth2-proxy","slug":"unknown-type-for-destination-t","errorCode":null,"errorMessage":"unknown type for destination: %T","messagePattern":"unknown type for destination: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/util/util.go","lineNumber":218,"sourceCode":"// interface.\nfunc CoerceClaim(value, dst any) error {\n\tswitch d := dst.(type) {\n\tcase *string:\n\t\tstr, err := toString(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not convert value to string: %v\", err)\n\t\t}\n\t\t*d = str\n\tcase *[]string:\n\t\tstrSlice, err := toStringSlice(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not convert value to string slice: %v\", err)\n\t\t}\n\t\t*d = strSlice\n\tcase *bool:\n\t\t*d = cast.ToBool(value)\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown type for destination: %T\", dst)\n\t}\n\treturn nil\n}\n\n// toStringSlice converts an interface (either a slice or single value) into\n// a slice of strings.\nfunc toStringSlice(value any) ([]string, error) {\n\tvar sliceValues []any\n\tswitch v := value.(type) {\n\tcase []any:\n\t\tsliceValues = v\n\tdefault:\n\t\tsliceValues = []any{v}\n\t}\n\n\tout := []string{}\n\tfor _, v := range sliceValues {\n\t\tstr, err := toString(v)","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/oauth2-proxy/oauth2-proxy/blob/33c2eb92dea78204f7a18bc2dfdbccc220f39257/pkg/util/util.go#L200-L236","documentation":"CoerceClaim returns this error when the destination pointer is of a type it does not support. Only *string, *[]string, and *bool destinations are handled; anything else (e.g. *int, map[string]any, non-pointer) falls into the default case. The %T verb names the offending destination type.","triggerScenarios":"getAdditionalClaim, GetClaimInto, or caller code passes a destination other than *string, *[]string, or *bool to CoerceClaim, hitting the default branch.","commonSituations":"Trying to coerce a numeric claim into *int or *float64; passing a non-pointer value; config code written against a newer CoerceClaim signature with extra supported types.","solutions":["Change the destination to one of the supported types (*string, *[]string, *bool)","Convert manually to a supported type first (e.g. coerce to string then strconv.Atoi)","Update the library if you need additional destination types, or add a case in CoerceClaim for your type","Ensure you pass a pointer, not a value"],"exampleFix":"// before\nvar count int\nerr := util.CoerceClaim(claims[\"access_count\"], &count)\n// after\nvar countStr string\nerr := util.CoerceClaim(claims[\"access_count\"], &countStr)\ncount, _ = strconv.Atoi(countStr)","handlingStrategy":"type-guard","validationCode":"switch dst.(type) { case *string, *[]string, *bool: /* supported */ default: /* unsupported */ }","typeGuard":"func supportedDst(dst any) bool {\n    switch dst.(type) {\n    case *string, *[]string, *bool:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if !supportedDst(dst) {\n    return fmt.Errorf(\"unsupported destination %T\", dst)\n}","preventionTips":["Only pass *string, *[]string, or *bool to CoerceClaim","Always pass pointers, not values","Convert numeric claims via a string intermediary"],"tags":["type-mismatch","jwt","claims","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"33c2eb92dea78204f7a18bc2dfdbccc220f39257","analyzedAt":"2026-09-06T08:51:53.077Z","contentChangedAt":"2026-09-06T08:51:53.077Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}