Skip to content

tools readRangeInFile error #8517

Closed

Description

@shuwenkai

Before submitting your bug report

Relevant environment info

- OS:
- Continue version:
- IDE version:
- Model:
- config:
  

  
  OR link to agent in Continue hub:

Description

I found that when using the read_file_range tool, the IntelliJ series of plugins throws an exception:
Error handling message of type readRangeInFile: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 9007199254740991 at line 1 column 153 path $.range.end.character
The issue occurs because:

Image

In core/tools/implementations/readFileRange.ts, Number.MAX_SAFE_INTEGER is used as the default value

Image

In extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt, the Position class defines character as Int

Image

Root Cause: JavaScript's Number.MAX_SAFE_INTEGER (2^53 - 1 = 9,007,199,254,740,991) exceeds Kotlin's Int maximum value (2^31 - 1 = 2,147,483,647), causing a deserialization error when the IntelliJ plugin attempts to parse the JSON.
Proposed Solution: Replace Number.MAX_SAFE_INTEGER with Number.MAX_VALUE or use a smaller value that's compatible with Kotlin's Int type (e.g., 2147483647 or Math.pow(2, 31) - 1).


To reproduce

No response

Log output

Activity

  1. added
    area:tools
    ide:jetbrains
    kind:bug
    on Oct 30, 2025
  2. shuwenkai commented on Oct 30, 2025

    @shuwenkai
    Author

    I modified the character in the TypeScript file to Math.pow(2, 31) - 1 , but a new problem appeared. If my model tells me to read lines 1-100, but my file only has 19 lines, it throws a new exception.

    Image Image I think we should take the minimum value between endLine and the size of fullContents.lines. Image
  3. shuwenkai commented on Nov 3, 2025

    @shuwenkai
    Author

    I modified the character in the TypeScript file to Math.pow(2, 31) - 1 , but a new problem appeared. If my model tells me to read lines 1-100, but my file only has 19 lines, it throws a new exception.

    Image Image I think we should take the minimum value between endLine and the size of fullContents.lines. Image

    emmm, I was careless, it should be : val endLine = min(range.end.line, lines.size-1) val endCharacter = min(range.end.character, lines.getOrNull(endLine)?.length ?: 0)

  4. added a commit that references this issue on Dec 2, 2025
    77053d5
  5. added a commit that references this issue on Dec 5, 2025
    d70bdbb
  6. sestinj commented on Dec 10, 2025

    @sestinj
    Contributor

    🎉 This issue has been resolved in version 1.36.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  7. sestinj commented on Jan 13, 2026

    @sestinj
    Contributor

    🎉 This issue has been resolved in version 1.38.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  8. sestinj commented on Jan 22, 2026

    @sestinj
    Contributor

    🎉 This issue has been resolved in version 1.8.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolside:jetbrainskind:bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions