{"record":{"id":"16a4b195183d50a2","repo":"inancgumus/learngo","slug":"wrong-input-v-line-d-16a4b1","errorCode":null,"errorMessage":"wrong input: %v (line #%d)","messagePattern":"wrong input: (.+?) \\(line #(.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"26-pointers/04-log-parser-pointers/parser.go","lineNumber":48,"sourceCode":"\tp.lines++\n\n\tfields := strings.Fields(line)\n\tif len(fields) != 2 {\n\t\tp.lerr = fmt.Errorf(\"wrong input: %v (line #%d)\", fields, p.lines)\n\t\treturn\n\t}\n\n\tparsed.domain = fields[0]\n\n\tvar err error\n\n\tparsed.visits, err = strconv.Atoi(fields[1])","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/inancgumus/learngo/blob/3c475a78e54336c6255e925ff66b8ef4da6a2ae7/26-pointers/04-log-parser-pointers/parser.go#L30-L66","documentation":"Pointer-based parse(): the error is stored in p.lerr instead of being returned, and all subsequent parse/update calls become no-ops once lerr is set. This instance fires when a line does not split into exactly two fields; p.lines was already incremented, so the message reports the true 1-based line number.","triggerScenarios":"Thrown at 26-pointers/04-log-parser-pointers/parser.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Let main detect p.lerr after parsing and report the offending line, then exit.","Sanitize or skip malformed lines before feeding them to parse.","Fix the log file so every line has a domain and a visits value."],"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"}