{"record":{"id":"869492b0f1f505e5","repo":"glanceapp/glance","slug":"invalid-query-parameter-value-type-t","errorCode":null,"errorMessage":"invalid query parameter value type: %T","messagePattern":"invalid query parameter value type: %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/config-fields.go","lineNumber":269,"sourceCode":"\t\tcase string:\n\t\t\t(*q)[key] = []string{v}\n\t\tcase int, int8, int16, int32, int64, float32, float64:\n\t\t\t(*q)[key] = []string{fmt.Sprintf(\"%v\", v)}\n\t\tcase bool:\n\t\t\t(*q)[key] = []string{fmt.Sprintf(\"%t\", v)}\n\t\tcase []string:\n\t\t\t(*q)[key] = append((*q)[key], v...)\n\t\tcase []any:\n\t\t\tfor _, item := range v {\n\t\t\t\tswitch item := item.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\t(*q)[key] = append((*q)[key], item)\n\t\t\t\tcase int, int8, int16, int32, int64, float32, float64:\n\t\t\t\t\t(*q)[key] = append((*q)[key], fmt.Sprintf(\"%v\", item))\n\t\t\t\tcase bool:\n\t\t\t\t\t(*q)[key] = append((*q)[key], fmt.Sprintf(\"%t\", item))\n\t\t\t\tdefault:\n\t\t\t\t\treturn fmt.Errorf(\"invalid query parameter value type: %T\", item)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"invalid query parameter value type: %T\", value)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (q *queryParametersField) toQueryString() string {\n\tquery := url.Values{}\n\n\tfor key, values := range *q {\n\t\tfor _, value := range values {\n\t\t\tquery.Add(key, value)\n\t\t}\n\t}","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/config-fields.go#L251-L287","documentation":"Returned by queryParametersField.UnmarshalYAML when, inside a list-typed query parameter value, one list element is not a string, number, or bool. The code type-switches each item of a []any; anything else (nested maps/lists, nulls) falls to the inner default branch. The %T verb prints the element's Go type, e.g. 'map[string]interface {}'.","triggerScenarios":"A query-parameters config like `key: [a, [b, c]]` or `key: [{v: 1}]` or a list containing a YAML null (`~`) — the nested list/map/nil element hits the default case.","commonSituations":"Trying to nest structures inside query param lists; YAML `~`/null entries from templating mistakes; over-structuring params when only flat scalars are supported.","solutions":["Flatten query parameter lists to scalars only: strings, numbers, booleans.","Remove null/`~` entries and nested lists/maps from parameter values.","For repeated params use a flat list: `key: [a, b, c]` — each element must be a scalar."],"exampleFix":"# before\nquery-parameters:\n  tag:\n    - featured\n    - [urgent, new]\n\n# after\nquery-parameters:\n  tag:\n    - featured\n    - urgent\n    - new","handlingStrategy":"type-guard","validationCode":"python3 - <<'EOF'\nimport sys,yaml\ndef scalars(v):\n    if isinstance(v,list):\n        return all(scalars(i) for i in v)\n    return isinstance(v,(str,int,float,bool)) and v is not None\ndef walk(o):\n    if isinstance(o,dict):\n        for k,v in o.items():\n            if k=='query-parameters' and not all(scalars(x) for x in v.values()):\n                sys.exit(f'non-scalar query param: {v}')\n            walk(v)\n    elif isinstance(o,list):\n        for i in o: walk(i)\nwalk(yaml.safe_load(open('glance.yml')))\nprint('ok')\nEOF","typeGuard":"// Go: guard before assigning into queryParametersField\nfunc isScalarOrScalarList(v any) bool {\n    switch t := v.(type) {\n    case string, int, int8, int16, int32, int64, float32, float64, bool:\n        return true\n    case []string, []any:\n        list, ok := any(t).([]any)\n        if !ok {\n            return true // []string\n        }\n        for _, item := range list {\n            switch item.(type) {\n            case string, int, int8, int16, int32, int64, float32, float64, bool:\n            default:\n                return false\n            }\n        }\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Keep query parameter list elements flat scalars.","Avoid null (`~`) entries in parameter lists."],"tags":["config","query-parameters","validation","yaml"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}