Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: java.lang.StringIndexOutOfBoundsException: begin 0, end 23, length 14 #1406

Closed
manuelpinhao-loba opened this issue Apr 28, 2024 · 1 comment · Fixed by #1506
Closed
Assignees
Labels
bug Something isn't working

Comments

@manuelpinhao-loba
Copy link

manuelpinhao-loba commented Apr 28, 2024

Cody Version

5.5.5

IDE Information

PhpStorm 2022.1.4
Build #PS-221.6008.16, built on July 20, 2022
Licensed to Manuel Pinhao / Manuel Pinhao
You have a perpetual fallback license for this version.
Subscription is active until May 16, 2024.
Runtime version: 11.0.15+10-b2043.56 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
run.processes.with.pty=TRUE

Non-Bundled Plugins:
com.sourcegraph.jetbrains (5.5.5)

Describe the bug

apparently when invoking cody autocomplete

Expected behavior

no errors

Additional context

Stacktrace:

java.lang.StringIndexOutOfBoundsException: begin 0, end 23, length 14
 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
 at java.base/java.lang.String.substring(String.java:1874)
 at com.sourcegraph.cody.autocomplete.CodyAutocompleteManager.displayAgentAutocomplete(CodyAutocompleteManager.kt:376)
 at com.sourcegraph.cody.autocomplete.CodyAutocompleteManager.processAutocompleteResult$lambda$15$lambda$14(CodyAutocompleteManager.kt:320)
 at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$4(WriteCommandAction.java:362)
 at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150)
 at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1015)
 at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:148)
 at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
 at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
 at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:157)
 at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:124)
 at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:362)
 at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:350)
 at com.sourcegraph.cody.autocomplete.CodyAutocompleteManager.processAutocompleteResult$lambda$15(CodyAutocompleteManager.kt:319)
 at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:215)
 at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
 at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:197)
 at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
 at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:511)
 at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:69)
 at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:112)
 at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
 at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
 at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
 at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
 at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
 at java.base/java.security.AccessController.doPrivileged(Native Method)
 at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
 at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
 at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
 at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:746)
 at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
 at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
 at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
 at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
 at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
 at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
 at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
 at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
 at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
 at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
 at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
 at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
 at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
 at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
 
@taylorsperry
Copy link
Contributor

taylorsperry commented May 1, 2024

This was also reported by QA. I've moved it into this sprint.

pkukielka added a commit that referenced this issue May 15, 2024
…ad (#1506)

Fixes #1406

## Changes

I cannot reproduce that error even doing the same thing as our QA tester
on a video with a fail.
I assume it may depend on what is returned by a backend in a given time.
Because of that I'm just adding a safeguard to not crash in case of
incorrect range being calculated, and instead log all the details.

## Test plan

N/A, I cannot reproduce an issue, but I added a safeguard against a
crash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants