{"record":{"id":"da04798305d0b935","repo":"grafana/k6","slug":"parse-json-options-failed-w","errorCode":null,"errorMessage":"parse JSON options failed: %w","messagePattern":"parse JSON options failed: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/config.go","lineNumber":87,"sourceCode":"\tHTTPPassword null.String `json:\"password\" envconfig:\"K6_OTEL_HTTP_EXPORTER_PASSWORD\"`\n\n\t// GRPCExporterEndpoint sets the target endpoint the OpenTelemetry Exporter\n\t// will connect to.\n\tGRPCExporterEndpoint null.String `json:\"grpcExporterEndpoint\" envconfig:\"K6_OTEL_GRPC_EXPORTER_ENDPOINT\"`\n\t// GRPCExporterInsecure disables client transport security for the Exporter's gRPC\n\t// connection.\n\tGRPCExporterInsecure null.Bool `json:\"grpcExporterInsecure\" envconfig:\"K6_OTEL_GRPC_EXPORTER_INSECURE\"`\n}\n\n// GetConsolidatedConfig combines the options' values from the different sources\n// and returns the merged options. The Order of precedence used is documented\n// in the k6 Documentation https://grafana.com/docs/k6/latest/using-k6/k6-options/how-to/#order-of-precedence.\nfunc GetConsolidatedConfig(jsonRawConf json.RawMessage, env map[string]string) (Config, error) {\n\tcfg := newDefaultConfig()\n\tif jsonRawConf != nil {\n\t\tjsonConf, err := parseJSON(jsonRawConf)\n\t\tif err != nil {\n\t\t\treturn cfg, fmt.Errorf(\"parse JSON options failed: %w\", err)\n\t\t}\n\t\tcfg = cfg.Apply(jsonConf)\n\t}\n\n\tif len(env) > 0 {\n\t\tenvConf, err := parseEnvs(env)\n\t\tif err != nil {\n\t\t\treturn cfg, fmt.Errorf(\"parse environment variables options failed: %w\", err)\n\t\t}\n\t\tcfg = cfg.Apply(envConf)\n\t}\n\n\tif err := cfg.Validate(); err != nil {\n\t\t// TODO: check why k6's still exiting with 255\n\t\treturn cfg, errext.WithExitCodeIfNone(\n\t\t\tfmt.Errorf(\"error validating OpenTelemetry output config: %w\", err),\n\t\t\texitcodes.InvalidConfig,\n\t\t)","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/opentelemetry/config.go#L69-L105","documentation":"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.","triggerScenarios":"Thrown at internal/output/opentelemetry/config.go:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the JSON syntax of the opentelemetry extension options","Make sure each field's value type matches the expected string/bool/number type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}