{"record":{"id":"eebd9214c2c8da57","repo":"inancgumus/learngo","slug":"wrong-input-v-line-d","errorCode":null,"errorMessage":"wrong input: %v (line #%d)","messagePattern":"wrong input: (.+?) \\(line #(.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"25-functions/03-refactor-to-funcs/parser.go","lineNumber":41,"sourceCode":"// parse parses a log line and returns the parsed result with an error\nfunc parse(p parser, line string) (parsed result, err error) {\n\tfields := strings.Fields(line)\n\tif len(fields) != 2 {\n\t\terr = fmt.Errorf(\"wrong input: %v (line #%d)\", fields, p.lines)\n\t\treturn\n\t}\n\n\tparsed.domain = fields[0]\n\n\tparsed.visits, err = strconv.Atoi(fields[1])","sourceCodeStart":23,"sourceCodeEnd":55,"githubUrl":"https://github.com/inancgumus/learngo/blob/3c475a78e54336c6255e925ff66b8ef4da6a2ae7/25-functions/03-refactor-to-funcs/parser.go#L23-L55","documentation":"parse() rejects a log line that does not split into exactly two whitespace-separated fields (domain and visits). fields is the []string from strings.Fields; the error embeds the offending fields slice and the line number tracked in p.lines so the user can locate the bad line in the log file.","triggerScenarios":"Thrown at 25-functions/03-refactor-to-funcs/parser.go:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Skip malformed lines and continue parsing the rest of the log, collecting the errors.","Fix the source log line so it has exactly a domain and a numeric visits column.","Halt parsing and report the first offending line with its number, as main does."],"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"}