grafana/k6 · error

couldn't make a batch: %w

Error message

couldn't make a batch: %w

What it means

The InfluxDB output failed to initialize the batch points container via client.NewBatchPoints with the configured BatchPointsConfig (precision, database, retention policy, write consistency). This wraps the underlying influxdb client error before any samples are converted.

Source

Thrown at internal/output/influxdb/output.go:115

				v, err = strconv.ParseFloat(val, 64)
			case Int:
				v, err = strconv.ParseInt(val, 10, 64)
			}
			if err == nil {
				values[tag] = v
			} else {
				values[tag] = val
			}
			delete(tags, tag)
		}
	}
	return values
}

func (o *Output) batchFromSamples(containers []metrics.SampleContainer) (client.BatchPoints, error) {
	batch, err := client.NewBatchPoints(o.BatchConf)
	if err != nil {
		return nil, fmt.Errorf("couldn't make a batch: %w", err)
	}

	type cacheItem struct {
		tags   map[string]string
		values map[string]any
	}
	cache := map[*metrics.TagSet]cacheItem{}
	for _, container := range containers {
		samples := container.GetSamples()
		for _, sample := range samples {
			var tags map[string]string
			values := make(map[string]any)
			if cached, ok := cache[sample.Tags]; ok {
				tags = cached.tags
				maps.Copy(values, cached.values)
			} else {
				tags = sample.Tags.Map()
				o.extractTagsToValues(tags, values)

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Check the wrapped error for the exact cause (e.g. invalid precision or database name)
  2. Verify K6_INFLUXDB_PRECISION, K6_INFLUXDB_DB, retention and consistency settings
  3. Ensure the target database exists on the InfluxDB server
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/output/influxdb/output.go:115 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/b134c522bf5ef61e. Report an issue: GitHub.