Skip to content

tools readRangeInFile error #8517

@shuwenkai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsRelates to tool usageide:jetbrainsRelates specifically to JetBrains extensionkind:bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions