VictoriaMetrics/VictoriaMetrics · error
missing columns in the csv line %q; got %d columns; want at
Error message
missing columns in the csv line %q; got %d columns; want at least %d columns
What it means
Set as sc.Error in csvimport parseRows when the CSV line contains fewer columns than the declared column descriptors require, so some fields cannot be filled. %q is the whole line, %d the number of columns found, and the last %d the required minimum.
Source
Thrown at lib/protoparser/csvimport/parser.go:172
Value: sc.Column,
})
continue
}
metricName := cd.MetricName
if metricName == "" {
logger.Panicf("BUG: unexpected empty MetricName")
}
value, err := fastfloat.Parse(sc.Column)
if err != nil {
sc.Error = fmt.Errorf("cannot parse metric value for %q from %q: %w", metricName, sc.Column, err)
}
metrics = append(metrics, metric{
Name: metricName,
Value: value,
})
}
if col < uint(len(cds)) && sc.Error == nil {
sc.Error = fmt.Errorf("missing columns in the csv line %q; got %d columns; want at least %d columns", line, col, len(cds))
}
if sc.Error != nil {
logger.Errorf("error when parsing csv line %q: %s; skipping this line", line, sc.Error)
invalidLines.Inc()
continue
}
if len(metrics) == 0 {
continue
}
r.Metric = metrics[0].Name
r.Tags = tags[tagsLen:]
r.Value = metrics[0].Value
dst = append(dst, r)
for _, m := range metrics[1:] {
dst = append(dst, Row{
Metric: m.Name,
Tags: r.Tags,
Value: m.Value,View on GitHub (pinned to 5079fb58f1)
Solutions
- Fix the CSV rows to include all columns referenced by the format
- Adjust the format descriptors to reference fewer columns
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/protoparser/csvimport/parser.go:172 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/bfde3d62abf55838.
Report an issue: GitHub.