grafana/k6 · error · TypeError
invalid value for metric metadata '%s': only String, Boolean
Error message
invalid value for metric metadata '%s': only String, Boolean and Number types are accepted as a metric metadata value
What it means
Error "invalid value for metric metadata '%s': only String, Boolean and Number types are accepted as a metric metadata value" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/execution/execution.go:431
state *lib.State
}
// Get a property value for the key. May return nil if the property does not exist.
func (o *metadataDynamicObject) Get(key string) sobek.Value {
tcv := o.state.Tags.GetCurrentValues()
if metadatum, ok := tcv.Metadata[key]; ok {
return o.runtime.ToValue(metadatum)
}
return nil
}
// Set a property value for the key. It returns true if successful. String, Boolean
// and Number types are implicitly converted to the Sobek's relative string
// representation. An exception is raised in case a denied type is provided.
func (o *metadataDynamicObject) Set(key string, val sobek.Value) bool {
o.state.Tags.Modify(func(tagsAndMeta *metrics.TagsAndMeta) {
if err := common.ApplyCustomUserMetadata(tagsAndMeta, key, val); err != nil {
panic(o.runtime.NewTypeError(err.Error()))
}
})
return true
}
// Has returns true if the property exists.
func (o *metadataDynamicObject) Has(key string) bool {
ctv := o.state.Tags.GetCurrentValues()
if _, ok := ctv.Metadata[key]; ok {
return true
}
return false
}
// Delete deletes the property for the key. It returns true on success (note,
// that includes missing property).
func (o *metadataDynamicObject) Delete(key string) bool {
o.state.Tags.Modify(func(tagsAndMeta *metrics.TagsAndMeta) {View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/execution/execution.go:431 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/382baa873c2aa20d.
Report an issue: GitHub.