{"record":{"id":"8fa3fdbdcfd00dd4","repo":"grafana/k6","slug":"parse-environment-variables-options-failed-w","errorCode":null,"errorMessage":"parse environment variables options failed: %w","messagePattern":"parse environment variables options failed: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/opentelemetry/config.go","lineNumber":95,"sourceCode":"}\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)\n\t}\n\n\treturn cfg, nil\n}\n\n// newDefaultConfig creates a new default config with default values\nfunc newDefaultConfig() Config {\n\treturn Config{","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/opentelemetry/config.go#L77-L113","documentation":"One or more K6_OTEL_* environment variables could not be processed into the OpenTelemetry output config. GetConsolidatedConfig wraps the envconfig/parse failure; typically a non-boolean for a bool flag or invalid duration/null-type value.","triggerScenarios":"Thrown at internal/output/opentelemetry/config.go:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for the offending variable","Use valid values, e.g. K6_OTEL_GRPC_EXPORTER_INSECURE=true and valid durations for interval settings"],"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"}