grafana/k6 · error

invalid authority value: '%#v', it needs to be a string

Error message

invalid authority value: '%#v', it needs to be a string

What it means

Raised in newConnectParams when the 'authority' option of grpc.connect (the :authority pseudo-header override) does not export as a Go string — a number, object, or other type was passed.

Solutions

  1. Pass a string, e.g. {authority: 'my-authority.example.com'}
  2. Omit the option to use the address-derived authority
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/grpc/params.go:210 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/0355d386f8f3f573. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/grpc/params.go:210

			}
		case "maxSendSize":
			var ok bool
			result.MaxSendSize, ok = v.(int64)
			if !ok {
				return result, fmt.Errorf("invalid maxSendSize value: '%#v', it needs to be an integer", v)
			}
			if result.MaxSendSize < 0 {
				return result, fmt.Errorf("invalid maxSendSize value: '%#v, it needs to be a positive integer", v)
			}
		case "tls":
			if err := parseConnectTLSParam(result, v); err != nil {
				return result, err
			}
		case "authority":
			var ok bool
			result.Authority, ok = v.(string)
			if !ok {
				return result, fmt.Errorf("invalid authority value: '%#v', it needs to be a string", v)
			}
		default:
			return result, fmt.Errorf("unknown connect param: %q", k)
		}
	}

	return result, nil
}

func parseConnectTLSParam(params *connectParams, v any) error {
	var ok bool
	params.TLS, ok = v.(map[string]any)

	if !ok {
		return fmt.Errorf("invalid tls value: '%#v', expected (optional) keys: cert, key, password, and cacerts", v)
	}
	// optional map keys below
	if cert, certok := params.TLS["cert"]; certok {

View on GitHub (pinned to 01ffac6f24)