grafana/k6 · error
parse JSON options failed: %w
Error message
parse JSON options failed: %w
What it means
The OpenTelemetry output's JSON configuration (options.ext or K6_OTEL_* JSON config) could not be unmarshalled into the OTel Config struct. GetConsolidatedConfig wraps the JSON decode error; the raw JSON has invalid syntax or wrong-typed fields.
Source
Thrown at internal/output/opentelemetry/config.go:87
HTTPPassword null.String `json:"password" envconfig:"K6_OTEL_HTTP_EXPORTER_PASSWORD"`
// GRPCExporterEndpoint sets the target endpoint the OpenTelemetry Exporter
// will connect to.
GRPCExporterEndpoint null.String `json:"grpcExporterEndpoint" envconfig:"K6_OTEL_GRPC_EXPORTER_ENDPOINT"`
// GRPCExporterInsecure disables client transport security for the Exporter's gRPC
// connection.
GRPCExporterInsecure null.Bool `json:"grpcExporterInsecure" envconfig:"K6_OTEL_GRPC_EXPORTER_INSECURE"`
}
// GetConsolidatedConfig combines the options' values from the different sources
// and returns the merged options. The Order of precedence used is documented
// in the k6 Documentation https://grafana.com/docs/k6/latest/using-k6/k6-options/how-to/#order-of-precedence.
func GetConsolidatedConfig(jsonRawConf json.RawMessage, env map[string]string) (Config, error) {
cfg := newDefaultConfig()
if jsonRawConf != nil {
jsonConf, err := parseJSON(jsonRawConf)
if err != nil {
return cfg, fmt.Errorf("parse JSON options failed: %w", err)
}
cfg = cfg.Apply(jsonConf)
}
if len(env) > 0 {
envConf, err := parseEnvs(env)
if err != nil {
return cfg, fmt.Errorf("parse environment variables options failed: %w", err)
}
cfg = cfg.Apply(envConf)
}
if err := cfg.Validate(); err != nil {
// TODO: check why k6's still exiting with 255
return cfg, errext.WithExitCodeIfNone(
fmt.Errorf("error validating OpenTelemetry output config: %w", err),
exitcodes.InvalidConfig,
)View on GitHub (pinned to 01ffac6f24)
Solutions
- Validate the JSON syntax of the opentelemetry extension options
- Make sure each field's value type matches the expected string/bool/number type
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/output/opentelemetry/config.go:87 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/da04798305d0b935.
Report an issue: GitHub.