{"record":{"id":"37196c884f1daef4","repo":"golangci/golangci-lint","slug":"failed-to-parse-column-from-q-w","errorCode":null,"errorMessage":"failed to parse column from %q: %w","messagePattern":"failed to parse column from %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/goanalysis/pkgerrors/parse.go","lineNumber":45,"sourceCode":"\nfunc parseErrorPosition(pos string) (*token.Position, error) {\n\t// file:line(<optional>:column)\n\tparts := strings.Split(pos, \":\")\n\tif len(parts) == 1 {\n\t\treturn nil, errors.New(\"no colons\")\n\t}\n\n\tfile := parts[0]\n\tline, err := strconv.Atoi(parts[1])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can't parse line number %q: %w\", parts[1], err)\n\t}\n\n\tvar column int\n\tif len(parts) == 3 { // got column\n\t\tcolumn, err = strconv.Atoi(parts[2])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse column from %q: %w\", parts[2], err)\n\t\t}\n\t}\n\n\treturn &token.Position{\n\t\tFilename: file,\n\t\tLine:     line,\n\t\tColumn:   column,\n\t}, nil\n}\n","sourceCodeStart":27,"sourceCodeEnd":55,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/goanalysis/pkgerrors/parse.go#L27-L55","documentation":"parseErrorPosition expects at most three colon-separated fields (file:line:column). When a third field exists but is not a valid integer, strconv.Atoi fails and the parser wraps the error with the offending column string via %w.","triggerScenarios":"A diagnostic line like 'file.go:12:abc: message' reaches parseError/extractErrors; parts has 3 elements and parts[2] is non-numeric.","commonSituations":"Analyzer or compiler output that appends extra text after the column without a fourth colon-separated message part; custom linters printing positions in a slightly different format; pasted/concatenated log lines.","solutions":["Inspect the exact string in the error; find the producer emitting 'file:line:<non-numeric>' positions","Normalize/filter the output so columns are numeric (or drop the column segment)","Upgrade or patch the tool producing malformed diagnostics","Pre-validate with regexp before parsing"],"exampleFix":"// before\n\"foo.go:12:x: something\"\n// after\n\"foo.go:12:3: something\"","handlingStrategy":"validation","validationCode":"// ensure exactly file:line:col with numeric col\nvar posRe = regexp.MustCompile(`^[^:]+:\\d+:\\d+(:\\s|$)`)\nfunc hasValidColumn(line string) bool { return posRe.MatchString(line) }","typeGuard":null,"tryCatchPattern":"pos, err := parseErrorPosition(s)\nif err != nil {\n    log.Printf(\"skipping line with bad column: %v\", err)\n    return nil\n}","preventionTips":["Verify custom analyzers print numeric columns","Use go/token.Position formatting for emitted diagnostics","Pre-filter output lines with a strict position regex","Add unit tests for parser edge cases"],"tags":["golangci-lint","parsing","go","strconv"],"backgroundTag":"column-parse-failed","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}