{"record":{"id":"e85cbf0aa367677b","repo":"grafana/k6","slug":"influxdb-s-concurrentwrites-must-be-a-positive-num","errorCode":null,"errorMessage":"influxdb's ConcurrentWrites must be a positive number","messagePattern":"influxdb's ConcurrentWrites must be a positive number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/influxdb/output.go","lineNumber":69,"sourceCode":"}\n\n// New returns new influxdb output\nfunc New(params output.Params) (output.Output, error) {\n\treturn newOutput(params)\n}\n\nfunc newOutput(params output.Params) (*Output, error) {\n\tconf, err := GetConsolidatedConfig(params.JSONConfig, params.Environment, params.ConfigArgument)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcl, err := MakeClient(conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbatchConf := MakeBatchConfig(conf)\n\tif conf.ConcurrentWrites.Int64 <= 0 {\n\t\treturn nil, errors.New(\"influxdb's ConcurrentWrites must be a positive number\")\n\t}\n\tfldKinds, err := MakeFieldKinds(conf)\n\treturn &Output{\n\t\tparams: params,\n\t\tlogger: params.Logger.WithFields(logrus.Fields{\n\t\t\t\"output\": \"InfluxDBv1\",\n\t\t}),\n\t\tClient:      cl,\n\t\tConfig:      conf,\n\t\tBatchConf:   batchConf,\n\t\tfieldKinds:  fldKinds,\n\t\tsemaphoreCh: make(chan struct{}, conf.ConcurrentWrites.Int64),\n\t\twg:          sync.WaitGroup{},\n\t}, err\n}\n\nfunc (o *Output) extractTagsToValues(tags map[string]string, values map[string]any) map[string]any {\n\tfor tag, kind := range o.fieldKinds {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/influxdb/output.go#L51-L87","documentation":"The InfluxDB output validates that the configured concurrency for parallel metric writes is a positive integer before constructing the output. K6_INFLUXDB_CONCURRENT_WRITES (or the equivalent JSON/CLI config) of 0 or a negative number fails with this error, because the output sizes its semaphore channel from this value.","triggerScenarios":"K6_INFLUXDB_CONCURRENT_WRITES=0 or a negative value in the environment; the corresponding -o influxdb=...,concurrentWrites=0 argument; empty-string values that parse to 0 in some wrappers.","commonSituations":"CI templates that define the variable but leave it empty/zero; attempts to 'disable' concurrency by setting 0; copy-pasted dashboards from old blog posts using invalid values.","solutions":["Set a positive integer, e.g. K6_INFLUXDB_CONCURRENT_WRITES=8 (the documented default)","Unset the variable to fall back to the default","Check for typos or empty values in wrapper scripts that export the variable"],"exampleFix":"# before\nexport K6_INFLUXDB_CONCURRENT_WRITES=0\nk6 run -o influxdb=http://localhost:8086/k6 script.js\n# after\nunset K6_INFLUXDB_CONCURRENT_WRITES   # default applies\nk6 run -o influxdb=http://localhost:8086/k6 script.js","handlingStrategy":"validation","validationCode":"// Shell\nn=\"${K6_INFLUXDB_CONCURRENT_WRITES:-}\"\nif [ -n \"$n\" ] && ! [ \"$n\" -gt 0 ] 2>/dev/null; then\n  echo \"K6_INFLUXDB_CONCURRENT_WRITES must be a positive integer\" >&2; exit 1\nfi","typeGuard":"function isPositiveInt(v) {\n  return /^\\d+$/.test(v) && parseInt(v, 10) > 0;\n}","tryCatchPattern":null,"preventionTips":["Don't repurpose K6_INFLUXDB_CONCURRENT_WRITES=0 to disable anything — unset it instead","Validate numeric env overrides once in a shared pre-run hook","Document the default (8-ish concurrency) so nobody invents values"],"tags":["influxdb","output","configuration","environment-variables","k6"],"backgroundTag":"invalid-config-value","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}