VictoriaMetrics/VictoriaMetrics · error

incorrect influx line %q: %w

Error message

incorrect influx line %q: %w

What it means

Top-level guard in Rows.unmarshal: one of the lines in the batch failed to parse and skipInvalidLines is false (non-streaming mode), so the entire request is rejected. The full multi-line input is echoed alongside the wrapped per-line cause.

Source

Thrown at lib/protoparser/influx/parser.go:234

	v, err := parseFieldValue(s[n+1:], uc)
	if err != nil {
		return fmt.Errorf("cannot parse field value for %q: %w", f.Key, err)
	}
	f.Value = v
	return nil
}

func (rs *Rows) unmarshal(s string, skipInvalidLines bool) error {
	rs.uc.hasEscapeChars = strings.IndexByte(s, '\\') >= 0
	for len(s) > 0 {
		n := strings.IndexByte(s, '\n')
		if n < 0 {
			// The last line.
			n = len(s)
		}
		if err := rs.unmarshalRow(s[:n]); err != nil {
			if !skipInvalidLines {
				return fmt.Errorf("incorrect influx line %q: %w", s, err)
			}
			logger.Errorf("skipping InfluxDB line %q because of error: %s", s, err)
			invalidLines.Inc()
		}
		if len(s) == n {
			return nil
		}
		s = s[n+1:]
	}
	return nil
}

func (rs *Rows) unmarshalRow(s string) error {
	if len(s) > 0 && s[len(s)-1] == '\r' {
		s = s[:len(s)-1]
	}
	if len(s) == 0 {
		// Skip empty line

View on GitHub (pinned to 5079fb58f1)

Solutions

  1. Read the wrapped error to find the first offending line and fix it at the sender
  2. Use the streaming ingest mode, which skips invalid lines instead of rejecting the request
  3. Validate batches client-side before sending to avoid whole-batch rejection
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/protoparser/influx/parser.go:234 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of VictoriaMetrics/VictoriaMetrics@5079fb58f1 (2026-09-03). Data as JSON: /api/errors/198cdf269296e52c. Report an issue: GitHub.