{"record":{"id":"264abc34107ce132","repo":"grafana/k6","slug":"q-value-must-be-binary","errorCode":null,"errorMessage":"%q value must be binary","messagePattern":"%q value must be binary","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/grpc/params.go","lineNumber":94,"sourceCode":"\tif common.IsNullish(input) {\n\t\treturn md, nil\n\t}\n\n\tv := input.Export()\n\n\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))","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/grpc/params.go#L76-L112","documentation":"Raised in newMetadata when a metadata key ending in '-bin' (gRPC's binary-key convention) has a value that is not a []byte after export — binary-suffixed keys must carry binary data, not strings or numbers.","triggerScenarios":"Thrown at internal/js/modules/k6/grpc/params.go:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide binary values (e.g. k6.encoding.b64decode(...) output or byte arrays) for '-bin' keys","Rename the key if it is not actually binary","Ensure the value survives sobek export as a byte array"],"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"}