grafana/k6 · error

invalid HTTP request metric tags: %w

Error message

invalid HTTP request metric tags: %w

What it means

In parseRequest, the tags parameter of an http request is applied through common.ApplyCustomUserTags; failure there (invalid tag shape, non-string values, bad object) is wrapped with this message. The per-request metric tags supplied in the params object are invalid.

Source

Thrown at js/modules/k6/http/request.go:395

				if algosString == "" {
					continue
				}
				algos := strings.Split(algosString, ",")
				var err error
				result.Compressions = make([]httpext.CompressionType, len(algos))
				for index, algo := range algos {
					algo = strings.TrimSpace(algo)
					result.Compressions[index], err = httpext.CompressionTypeString(algo)
					if err != nil {
						return nil, fmt.Errorf("unknown compression algorithm %s, supported algorithms are %s",
							algo, httpext.CompressionTypeValues())
					}
				}
			case "redirects":
				result.Redirects = null.IntFrom(params.Get(k).ToInteger())
			case "tags":
				if err := common.ApplyCustomUserTags(rt, &result.TagsAndMeta, params.Get(k)); err != nil {
					return nil, fmt.Errorf("invalid HTTP request metric tags: %w", err)
				}
			case "auth":
				result.Auth = params.Get(k).String()
			case "timeout":
				t, err := types.GetDurationValue(params.Get(k).Export())
				if err != nil {
					return nil, fmt.Errorf("invalid timeout value: %w", err)
				}
				result.Timeout = t
			case "throw":
				result.Throw = params.Get(k).ToBoolean()
			case "responseType":
				responseType, err := httpext.ResponseTypeString(params.Get(k).String())
				if err != nil {
					return nil, err
				}
				result.ResponseType = responseType
			case "responseCallback":

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Use only string, boolean or number values in the tags option
  2. Convert objects/arrays to strings before using them as tags
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at js/modules/k6/http/request.go:395 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/e51c925784f22197. Report an issue: GitHub.