{"record":{"id":"3345bd17819a651b","repo":"grafana/k6","slug":"invalid-value-for-metric-tag-s-only-string-bo-3345bd","errorCode":null,"errorMessage":"invalid value for metric tag '%s': only String, Boolean and Number types are accepted as a metric tag values","messagePattern":"invalid value for metric tag '(.+?)': only String, Boolean and Number types are accepted as a metric tag values","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/execution/execution.go","lineNumber":374,"sourceCode":"\tstate   *lib.State\n}\n\n// Get a property value for the key. May return nil if the property does not exist.\nfunc (o *tagsDynamicObject) Get(key string) sobek.Value {\n\ttcv := o.state.Tags.GetCurrentValues()\n\tif tag, ok := tcv.Tags.Get(key); ok {\n\t\treturn o.runtime.ToValue(tag)\n\t}\n\treturn nil\n}\n\n// Set a property value for the key. It returns true if succeed. String, Boolean\n// and Number types are implicitly converted to the Sobek's relative string\n// representation. An exception is raised in case a denied type is provided.\nfunc (o *tagsDynamicObject) Set(key string, val sobek.Value) bool {\n\to.state.Tags.Modify(func(tagsAndMeta *metrics.TagsAndMeta) {\n\t\tif err := common.ApplyCustomUserTag(tagsAndMeta, key, val); err != nil {\n\t\t\tpanic(o.runtime.NewTypeError(err.Error()))\n\t\t}\n\t})\n\treturn true\n}\n\n// Has returns true if the property exists.\nfunc (o *tagsDynamicObject) Has(key string) bool {\n\tctv := o.state.Tags.GetCurrentValues()\n\tif _, ok := ctv.Tags.Get(key); ok {\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Delete deletes the property for the key. It returns true on success (note,\n// that includes missing property).\nfunc (o *tagsDynamicObject) Delete(key string) bool {\n\to.state.Tags.Modify(func(tagsAndMeta *metrics.TagsAndMeta) {","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/execution/execution.go#L356-L392","documentation":"tagsDynamicObject.Set (backing execution.vu.tags[tag]=value) received a value that cannot be converted to a metric tag: only String, Boolean and Number are accepted. Objects, null, undefined, symbols, and functions are denied; the assignment raises an exception in the JS runtime.","triggerScenarios":"Thrown at internal/js/modules/k6/execution/execution.go:374 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign only strings, booleans, or numbers to execution.vu.tags entries","Convert objects to strings explicitly (e.g. JSON.stringify or String(...)) before assigning","Remove null/undefined assignments; clear tags via k6 API if supported"],"exampleFix":null,"handlingStrategy":"type-guard","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"}