{"record":{"id":"49fe2cb622ec3e76","repo":"plandex-ai/plandex","slug":"error-extracting-start-line-number-v","errorCode":null,"errorMessage":"error extracting start line number: %v","messagePattern":"error extracting start line number: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/shared/streamed_change.go","lineNumber":41,"sourceCode":"\nfunc (streamedChangeSection StreamedChangeSection) GetLines() (int, int, error) {\n\treturn streamedChangeSection.GetLinesWithPrefix(\"pdx-\")\n}\n\nfunc (streamedChangeSection StreamedChangeSection) GetLinesWithPrefix(prefix string) (int, int, error) {\n\tvar startLine, endLine int\n\tvar err error\n\n\tif streamedChangeSection.StartLineString == \"\" {\n\t\tlog.Printf(\"StartLineString is empty\\n\")\n\t\t// spew.Dump(streamedChangeSection)\n\t\tstartLine = streamedChangeSection.StartLine\n\t} else {\n\t\tstartLine, err = ExtractLineNumberWithPrefix(streamedChangeSection.StartLineString, prefix)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error extracting start line number: %v\\n\", err)\n\t\t\treturn 0, 0, fmt.Errorf(\"error extracting start line number: %v\", err)\n\t\t}\n\t}\n\n\tif streamedChangeSection.EndLineString == \"\" {\n\t\tlog.Printf(\"EndLineString is empty\\n\")\n\t\t// spew.Dump(streamedChangeSection)\n\t\tif streamedChangeSection.EndLine > 0 {\n\t\t\tendLine = streamedChangeSection.EndLine\n\t\t} else {\n\t\t\tendLine = startLine\n\t\t}\n\t} else {\n\t\tendLine, err = ExtractLineNumberWithPrefix(streamedChangeSection.EndLineString, prefix)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error extracting end line number: %v\\n\", err)\n\t\t\treturn 0, 0, fmt.Errorf(\"error extracting end line number: %v\", err)\n\t\t}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/shared/streamed_change.go#L23-L59","documentation":"GetLinesWithPrefix resolves a streamed change section's line range. When StartLineString is non-empty it must be parsed via ExtractLineNumberWithPrefix; this error wraps that parse failure, meaning the start-line string is not a valid prefixed line number (e.g. missing prefix, non-numeric).","triggerScenarios":"GetLines / GetLinesWithPrefix receiving a StreamedChangeSection whose StartLineString fails ExtractLineNumberWithPrefix (bad prefix match, no numeric part, or Atoi failure propagated through).","commonSituations":"Streaming LLM output truncated or malformed mid-section so the start line marker is incomplete; using a different line prefix than the one passed in; section parsed from a different code-fence style.","solutions":["Check the wrapped %v error (\"no line number found\" vs \"invalid line number\") to see which sub-parse failed","Ensure the `prefix` argument matches the prefix used when the section was generated","Validate the streamed section's StartLineString before calling GetLines (see validationCode)","Re-request the streamed change if the output was truncated/malformed"],"exampleFix":"// before\nstart, end, err := GetLinesWithPrefix(section, \"  \")\n// after\nif section.StartLineString == \"\" { return nil, errors.New(\"missing start line\") }\nif _, err := ExtractLineNumberWithPrefix(section.StartLineString, \"  \"); err != nil { return nil, fmt.Errorf(\"bad start line %q: %w\", section.StartLineString, err) }\nstart, end, err := GetLinesWithPrefix(section, \"  \")","handlingStrategy":"validation","validationCode":"func validStartLine(section shared.StreamedChangeSection, prefix string) bool {\n    if section.StartLineString == \"\" { return true } // resolved from StartLine\n    _, err := shared.ExtractLineNumberWithPrefix(section.StartLineString, prefix)\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":"start, end, err := GetLinesWithPrefix(section, prefix)\nif err != nil {\n    if strings.Contains(err.Error(), \"start line number\") {\n        return fmt.Errorf(\"malformed streamed section start %q: %w\", section.StartLineString, err)\n    }\n    return err\n}","preventionTips":["Verify streamed output is complete before parsing sections","Use the same prefix constant for generation and parsing","Reject marker lines that are not `<prefix><digits>:` early"],"tags":["go","parsing","line-numbers","streaming"],"backgroundTag":"invalid-line-number-format","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}