{"record":{"id":"71dd7ba903a82e46","repo":"inancgumus/learngo","slug":"incorrect-field-q-q","errorCode":null,"errorMessage":"incorrect field -> %q = %q","messagePattern":"incorrect field -> %q = %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"logparser/functional/field.go","lineNumber":26,"sourceCode":"// uatoi parses an unsigned integer string and saves the error.\n// it assumes that the val is unsigned.\n// for ease of usability: it returns an int instead of uint.\nfunc (f *field) uatoi(name, val string) int {\n\tn, err := strconv.Atoi(val)\n\tif err != nil || n < 0 {\n\t\tf.err = fmt.Errorf(\"incorrect field -> %q = %q\", name, val)\n\t}\n\treturn n\n}","sourceCodeStart":8,"sourceCodeEnd":42,"githubUrl":"https://github.com/inancgumus/learngo/blob/3c475a78e54336c6255e925ff66b8ef4da6a2ae7/logparser/functional/field.go#L8-L42","documentation":"field.uatoi is an error-collecting helper used in functional-style parsing: it tries strconv.Atoi on a named field value and, if conversion fails or the number is negative, stores this error in f.err (to be checked later) while returning 0. It fires on malformed or negative numeric fields, e.g. a visits or uniques column like \"-3\" or \"abc\" in a log line.","triggerScenarios":"Thrown at logparser/functional/field.go:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["After parsing a line, check f.err != nil and reject or skip the record.","Validate the field is a non-negative integer before calling uatoi.","Fix the log data so the named field holds a valid unsigned integer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3c475a78e54336c6255e925ff66b8ef4da6a2ae7","analyzedAt":"2026-09-02T10:14:38.492Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}