VictoriaMetrics/VictoriaMetrics · error

<column_pos> cannot be smaller than 1; got %d for entry #%d

Error message

<column_pos> cannot be smaller than 1; got %d for entry #%d %q

What it means

Position validation in ParseColumnDescriptors: a descriptor's <column_pos> parsed as an integer smaller than 1, but positions are 1-based. The entry index and raw entry text are echoed so the offending field in the -csvImportColumns-style spec can be located.

Source

Thrown at lib/protoparser/csvimport/column_descriptor.go:73

// s must contain at least a single 'metric' column and no more than a single `time` column.
func ParseColumnDescriptors(s string) ([]ColumnDescriptor, error) {
	m := make(map[int]ColumnDescriptor)
	cols := strings.Split(s, ",")
	hasValueCol := false
	hasTimeCol := false
	maxPos := 0
	for i, col := range cols {
		var cd ColumnDescriptor
		a := strings.SplitN(col, ":", 3)
		if len(a) != 3 {
			return nil, fmt.Errorf("entry #%d must have the following form: <column_pos>:<column_type>:<extension>; got %q", i+1, a)
		}
		pos, err := strconv.Atoi(a[0])
		if err != nil {
			return nil, fmt.Errorf("cannot parse <column_pos> part from the entry #%d %q: %w", i+1, col, err)
		}
		if pos <= 0 {
			return nil, fmt.Errorf("<column_pos> cannot be smaller than 1; got %d for entry #%d %q", pos, i+1, col)
		}
		if pos > maxColumnsPerRow {
			return nil, fmt.Errorf("<column_pos> cannot be bigger than %d; got %d for entry #%d %q", maxColumnsPerRow, pos, i+1, col)
		}
		if pos > maxPos {
			maxPos = pos
		}
		typ := a[1]
		switch typ {
		case "time":
			if hasTimeCol {
				return nil, fmt.Errorf("duplicate time column has been found at entry #%d %q for %q", i+1, col, s)
			}
			parseTimestamp, err := parseTimeFormat(a[2])
			if err != nil {
				return nil, fmt.Errorf("cannot parse time format from the entry #%d %q: %w", i+1, col, err)
			}
			cd.ParseTimestamp = parseTimestamp

View on GitHub (pinned to 5079fb58f1)

Solutions

  1. Use a position >= 1 matching the CSV column order (first column is 1)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/protoparser/csvimport/column_descriptor.go:73 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/a2fac6f746d896bb. Report an issue: GitHub.