{"record":{"id":"d90b890037a115a6","repo":"plandex-ai/plandex","slug":"no-line-number-found","errorCode":null,"errorMessage":"no line number found","messagePattern":"no line number found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/shared/streamed_change.go","lineNumber":89,"sourceCode":"\t\treturn 0, 0, fmt.Errorf(\"start line is less than 1: %d\", startLine)\n\t}\n\n\treturn startLine, endLine, nil\n}\n\nfunc ExtractLineNumber(line string) (int, error) {\n\treturn ExtractLineNumberWithPrefix(line, \"pdx-\")\n}\n\nfunc ExtractLineNumberWithPrefix(line, prefix string) (int, error) {\n\t// Split the line at the first space to isolate the line number\n\tparts := strings.SplitN(line, \" \", 2)\n\n\t// Remove the colon from the line number part\n\tlineNumberStr := strings.TrimSuffix(parts[0], \":\")\n\tlineNumberStr = strings.TrimPrefix(lineNumberStr, prefix)\n\tif lineNumberStr == \"\" {\n\t\treturn 0, fmt.Errorf(\"no line number found\")\n\t}\n\n\t// Convert the line number part to an integer\n\tlineNumber, err := strconv.Atoi(lineNumberStr)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"invalid line number: %v\", err)\n\t}\n\n\treturn lineNumber, nil\n}\n","sourceCodeStart":71,"sourceCodeEnd":100,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/shared/streamed_change.go#L71-L100","documentation":"ExtractLineNumberWithPrefix splits the line at the first space, trims the colon and the expected prefix, and requires a non-empty remainder to parse as the line number. This error means nothing remained after stripping the prefix — the string does not contain a line number in the expected `<prefix><number>:` format.","triggerScenarios":"ExtractLineNumberWithPrefix (directly or via ExtractLineNumber or GetLinesWithPrefix, or handleXMLResponse) receiving an empty string, a string that is only the prefix, or a marker line with no numeric component after the prefix/colon.","commonSituations":"Calling ExtractLineNumber on a non-marker line (blank line or code line); prefix mismatch so trimming consumed everything; streaming produced an incomplete marker like \"12:\" with prefix stripping removing the digits.","solutions":["Verify the input is actually a line-number marker line, not arbitrary content","Ensure the `prefix` passed matches exactly the prefix used when generating markers","Check that the line includes digits after the prefix (e.g. \"12: code\" not \": code\")","Trim/handle empty lines before attempting extraction"],"exampleFix":"// before\nn, err := ExtractLineNumberWithPrefix(line, \"|\") // line=\"|: foo\"\n// after\ntrimmed := strings.TrimPrefix(line, \"|\")\nif trimmed == \"\" || !strings.ContainsAny(trimmed, \"0123456789\") { skip(line) } else { n, err = ExtractLineNumberWithPrefix(line, \"|\") }","handlingStrategy":"type-guard","validationCode":"func isLineNumberMarker(line, prefix string) bool {\n    t := strings.TrimPrefix(strings.SplitN(line, \" \", 2)[0], prefix)\n    t = strings.TrimSuffix(t, \":\")\n    if t == \"\" { return false }\n    _, err := strconv.Atoi(t)\n    return err == nil\n}","typeGuard":"func looksLikeMarker(line string) bool {\n    t := strings.TrimSuffix(strings.SplitN(line, \" \", 2)[0], \":\")\n    return t != \"\" && strings.ContainsAny(t, \"0123456789\")\n}","tryCatchPattern":"n, err := ExtractLineNumberWithPrefix(line, prefix)\nif err != nil {\n    if strings.Contains(err.Error(), \"no line number found\") {\n        return 0, fmt.Errorf(\"line %q is not a numbered marker\", line)\n    }\n    return 0, err\n}","preventionTips":["Skip blank and non-marker lines before extraction","Keep the prefix consistent between generation and parsing","Check digits exist after prefix trimming before Atoi"],"tags":["go","parsing","line-numbers","streaming"],"backgroundTag":"missing-line-number-marker","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}