{"record":{"id":"9ad31b3337246878","repo":"grafana/k6","slug":"q-value-must-be-a-string","errorCode":null,"errorMessage":"%q value must be a string","messagePattern":"%q value must be a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/params.go","lineNumber":100,"sourceCode":"\trawHeaders, ok := v.(map[string]any)\n\tif !ok {\n\t\treturn md, errors.New(\"must be an object with key-value pairs\")\n\t}\n\n\tfor hk, kv := range rawHeaders {\n\t\tvar val string\n\t\t// The gRPC spec defines that Binary-valued keys end in -bin\n\t\t// https://grpc.io/docs/what-is-grpc/core-concepts/#metadata\n\t\tif strings.HasSuffix(hk, \"-bin\") {\n\t\t\tvar binVal []byte\n\t\t\tif binVal, ok = kv.([]byte); !ok {\n\t\t\t\treturn md, fmt.Errorf(\"%q value must be binary\", hk)\n\t\t\t}\n\n\t\t\t// https://github.com/grpc/grpc-go/blob/v1.57.0/Documentation/grpc-metadata.md#storing-binary-data-in-metadata\n\t\t\tval = string(binVal)\n\t\t} else if val, ok = kv.(string); !ok {\n\t\t\treturn md, fmt.Errorf(\"%q value must be a string\", hk)\n\t\t}\n\n\t\tmd.Append(hk, val)\n\t}\n\n\treturn md, nil\n}\n\n// SetSystemTags sets the system tags for the call.\nfunc (p *callParams) SetSystemTags(state *lib.State, addr string, methodName string) {\n\tif state.Options.SystemTags.Has(metrics.TagURL) {\n\t\tp.TagsAndMeta.SetSystemTagOrMeta(metrics.TagURL, fmt.Sprintf(\"%s%s\", addr, methodName))\n\t}\n\n\tparts := strings.Split(methodName[1:], \"/\")\n\tp.TagsAndMeta.SetSystemTagOrMetaIfEnabled(state.Options.SystemTags, metrics.TagService, parts[0])\n\tp.TagsAndMeta.SetSystemTagOrMetaIfEnabled(state.Options.SystemTags, metrics.TagMethod, parts[1])\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/grpc/params.go#L82-L118","documentation":"Raised in newMetadata when a non-binary metadata key's value is not a string — regular gRPC metadata keys must map to string values after export.","triggerScenarios":"Thrown at internal/js/modules/k6/grpc/params.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert values to strings, e.g. String(123) or 'authoritative'","Use a '-bin' suffixed key with a byte array for binary data","Ensure nested objects/arrays are not used as metadata values"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}