{"record":{"id":"dbc3fa50137c13ad","repo":"caddyserver/caddy","slug":"unsupported-value-type-in-matcher-input-t","errorCode":null,"errorMessage":"unsupported value type in matcher input: %T","messagePattern":"unsupported value type in matcher input: %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/celmatcher.go","lineNumber":707,"sourceCode":"\t\t}\n\t} else {\n\t\tmapStrIface = mapStrRaw.(map[string]any)\n\t}\n\tmapStrListStr := make(map[string][]string, len(mapStrIface))\n\tfor k, v := range mapStrIface {\n\t\tswitch val := v.(type) {\n\t\tcase string:\n\t\t\tmapStrListStr[k] = []string{val}\n\t\tcase types.String:\n\t\t\tmapStrListStr[k] = []string{string(val)}\n\t\tcase []string:\n\t\t\tmapStrListStr[k] = val\n\t\tcase []ref.Val:\n\t\t\tconvVals := make([]string, len(val))\n\t\t\tfor i, elem := range val {\n\t\t\t\tstrVal, ok := elem.(types.String)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unsupported value type in matcher input: %T\", val)\n\t\t\t\t}\n\t\t\t\tconvVals[i] = string(strVal)\n\t\t\t}\n\t\t\tmapStrListStr[k] = convVals\n\t\tcase []any:\n\t\t\tconvVals := make([]string, len(val))\n\t\t\tfor i, elem := range val {\n\t\t\t\tswitch e := elem.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\tconvVals[i] = e\n\t\t\t\tcase types.String:\n\t\t\t\t\tconvVals[i] = string(e)\n\t\t\t\tdefault:\n\t\t\t\t\treturn nil, fmt.Errorf(\"unsupported element type in matcher input list: %T\", elem)\n\t\t\t\t}\n\t\t\t}\n\t\t\tmapStrListStr[k] = convVals\n\t\tdefault:","sourceCodeStart":689,"sourceCodeEnd":725,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/celmatcher.go#L689-L725","documentation":"Thrown when converting CEL matcher input maps to map[string][]string: a value is a []ref.Val (a CEL list) but one of its elements is not a types.String (e.g. an int or bool CEL value). Since header values must be strings, the element cannot be converted.","triggerScenarios":"A CEL matcher whose map value is a heterogeneous list, e.g. {'x': [1, 'a']} — the []ref.Val case iterates elements and requires each to be types.String; an int element fails the type assertion.","commonSituations":"CEL expressions mixing types in lists used as header matcher input; configs written by tools that emit JSON numbers where header values are expected.","solutions":["Make all list elements in the matcher map strings (quote numbers/booleans)","Validate the matcher input map is map[string][]string-shaped before passing it to the CEL matcher","Simplify the expression to use explicit string literals"],"exampleFix":"// before\n{'accept': [1, 'gzip']}\n// after\n{'accept': ['1', 'gzip']}","handlingStrategy":"validation","validationCode":"// Ensure every header matcher value is []string of strings before serializing\nfunc isStringSlice(v any) bool {\n    s, ok := v.([]string)\n    return ok && len(s) >= 0\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep matcher map values as string slices only","Quote all scalars destined for header values"],"tags":["caddy","cel","matcher","type-conversion"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}