{"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/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/output/influxdb/output.go#L51-L87","documentation":"Thrown by the InfluxDB v1 output constructor when the resolved concurrentWrites setting is <= 0. The value sizes the semaphore channel (make(chan struct{}, conf.ConcurrentWrites.Int64)) used to bound concurrent write batches, so zero or negative values cannot initialize the output.","triggerScenarios":"Setting K6_INFLUXDB_CONCURRENT_WRITES=0 or a negative number; passing --out influxdb=...,concurrentWrites=0; a JSON config for the output with \"concurrentWrites\": 0; any tooling that templates the env var to an empty/zero value.","commonSituations":"Copy-pasted output flag strings with a typo'd concurrentWrites=0; attempts to 'disable' concurrency by setting the knob to 0; container environments where an unset numeric env var resolves to 0 due to templating (e.g. K6_INFLUXDB_CONCURRENT_WRITES=\"${WRITES:-0}\").","solutions":["Set concurrentWrites to a positive integer (default is 8 for typical setups): K6_INFLUXDB_CONCURRENT_WRITES=8","Remove the concurrentWrites key from the -o influxdb=... argument string or the env var so the default applies","Fix CI templates that default numeric env vars to 0"],"exampleFix":"# before\nk6 run -o influxdb=http://localhost:8086/k6,concurrentWrites=0 script.js\n\n# after\nk6 run -o influxdb=http://localhost:8086/k6,concurrentWrites=8 script.js","handlingStrategy":"validation","validationCode":"WRITES=${K6_INFLUXDB_CONCURRENT_WRITES:-8}\nif ! [[ \"$WRITES\" =~ ^[1-9][0-9]*$ ]]; then echo \"concurrentWrites must be >= 1, got '$WRITES'\"; exit 1; fi\nexport K6_INFLUXDB_CONCURRENT_WRITES=$WRITES","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never default numeric output knobs to 0 in templates","Prefer omitting concurrentWrites so k6's default applies","Validate all -o influxdb=... key=value pairs in a preflight lint step"],"tags":["k6","influxdb","output","config","concurrency"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}