{"record":{"id":"a2fac6f746d896bb","repo":"VictoriaMetrics/VictoriaMetrics","slug":"column-pos-cannot-be-smaller-than-1-got-d-for","errorCode":null,"errorMessage":"<column_pos> cannot be smaller than 1; got %d for entry #%d %q","messagePattern":"<column_pos> cannot be smaller than 1; got (.+?) for entry #(.+?) %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/protoparser/csvimport/column_descriptor.go","lineNumber":73,"sourceCode":"// s must contain at least a single 'metric' column and no more than a single `time` column.\nfunc ParseColumnDescriptors(s string) ([]ColumnDescriptor, error) {\n\tm := make(map[int]ColumnDescriptor)\n\tcols := strings.Split(s, \",\")\n\thasValueCol := false\n\thasTimeCol := false\n\tmaxPos := 0\n\tfor i, col := range cols {\n\t\tvar cd ColumnDescriptor\n\t\ta := strings.SplitN(col, \":\", 3)\n\t\tif len(a) != 3 {\n\t\t\treturn nil, fmt.Errorf(\"entry #%d must have the following form: <column_pos>:<column_type>:<extension>; got %q\", i+1, a)\n\t\t}\n\t\tpos, err := strconv.Atoi(a[0])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse <column_pos> part from the entry #%d %q: %w\", i+1, col, err)\n\t\t}\n\t\tif pos <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"<column_pos> cannot be smaller than 1; got %d for entry #%d %q\", pos, i+1, col)\n\t\t}\n\t\tif pos > maxColumnsPerRow {\n\t\t\treturn nil, fmt.Errorf(\"<column_pos> cannot be bigger than %d; got %d for entry #%d %q\", maxColumnsPerRow, pos, i+1, col)\n\t\t}\n\t\tif pos > maxPos {\n\t\t\tmaxPos = pos\n\t\t}\n\t\ttyp := a[1]\n\t\tswitch typ {\n\t\tcase \"time\":\n\t\t\tif hasTimeCol {\n\t\t\t\treturn nil, fmt.Errorf(\"duplicate time column has been found at entry #%d %q for %q\", i+1, col, s)\n\t\t\t}\n\t\t\tparseTimestamp, err := parseTimeFormat(a[2])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"cannot parse time format from the entry #%d %q: %w\", i+1, col, err)\n\t\t\t}\n\t\t\tcd.ParseTimestamp = parseTimestamp","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/protoparser/csvimport/column_descriptor.go#L55-L91","documentation":"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.","triggerScenarios":"Thrown at lib/protoparser/csvimport/column_descriptor.go:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a position >= 1 matching the CSV column order (first column is 1)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}