question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IllegalArgumentException: end cannot negative. [end: -1]

See original GitHub issue

I have the following crash in production. The stacktrace doesn’t refer to my code in any place and unfortunatelly I’m not able to reproduce it.

Besides everything else - there’s missing “be” in the exception message.

Fatal Exception: java.lang.IllegalArgumentException: end cannot negative. [end: -1]
       at androidx.compose.ui.text.TextRangeKt.packWithCheck(TextRangeKt.java:124)
       at androidx.compose.ui.text.TextRangeKt.TextRange(TextRangeKt.java:37)
       at androidx.compose.ui.text.input.EditingBuffer.delete$ui_text_release(EditingBuffer.kt:205)
       at androidx.compose.ui.text.input.DeleteSurroundingTextCommand.applyTo(EditCommand.kt:271)
       at androidx.compose.ui.text.input.EditProcessor.apply(EditProcessor.java:110)
       at androidx.compose.foundation.text.TextFieldKeyInput.apply(TextFieldKeyInput.kt:62)
       at androidx.compose.foundation.text.TextFieldKeyInput.access$apply(TextFieldKeyInput.java:49)
       at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.kt:134)
       at androidx.compose.foundation.text.TextFieldKeyInput$process$2.invoke(TextFieldKeyInput.kt:102)
       at androidx.compose.foundation.text.TextFieldKeyInput.commandExecutionContext(TextFieldKeyInput.java:211)
       at androidx.compose.foundation.text.TextFieldKeyInput.process-ZmokQxo(TextFieldKeyInput.java:102)
       at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke-ZmokQxo(TextFieldKeyInput.kt:243)
       at androidx.compose.foundation.text.TextFieldKeyInputKt$textFieldKeyInput$2$1.invoke(TextFieldKeyInput.kt:243)
       at androidx.compose.ui.node.ModifiedKeyInputNode.propagateKeyEvent-ZmokQxo(ModifiedKeyInputNode.kt:47)
       at androidx.compose.ui.input.key.KeyInputModifier.processKeyInput-ZmokQxo(KeyInputModifier.java:78)
       at androidx.compose.ui.platform.AndroidComposeView.sendKeyEvent-ZmokQxo(AndroidComposeView.android.kt:562)
       at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:569)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1986)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1986)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1986)
       at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1986)
       at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:946)
       at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1947)
       at android.app.Activity.dispatchKeyEvent(Activity.java:4147)
       at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:122)
       at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:84)
       at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:140)
       at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:800)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:7490)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:7316)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6709)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6766)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6732)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6911)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6740)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6968)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6713)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6766)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6732)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6740)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6713)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:10001)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9839)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9792)
       at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:6313)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:247)
       at android.app.ActivityThread.main(ActivityThread.java:8656)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
anil-basantanicommented, May 5, 2022

This issue is reproducible on Samsung devices while pressing “DEL” key from keyboard, It will crash along with above crash logs. I’m also facing same issue.

0reactions
LittleYolkcommented, Aug 23, 2022

I had this problem too on Desktop (Windows), but it seems to be resolved in v1.2.0-alpha01-dev741.

The version I use is v1.2.0-alpha04

Read more comments on GitHub >

github_iconTop Results From Across the Web

When delete key pressed: java.lang.IllegalArgumentException ...
the cursor was at the end of the textfield. suddenly the app crashed. Error java.lang.IllegalArgumentException: end cannot negative. [end: -1].
Read more >
Crash Issue: java.lang.IllegalArgumentException: end cannot ...
1.Crash reported only during the play store app upload validation by google. ... IllegalArgumentException: end cannot negative. [end: -1]
Read more >
PrecomputedText - Android Developers
IllegalArgumentException, if start and end offset are in the different paragraph. ... FontMetricsInt: the output font metrics This value cannot be null ....
Read more >
leftalignindels: java.lang.IllegalArgumentException: the range ...
IllegalArgumentException : the range cannot contain negative indices ... and we want to look at this on our end to find the specific...
Read more >
How to solve an IllegalArgumentException in Java?
When Arguments out of range. For example, the percentage should lie between 1 to 100. · When argument format is invalid. · When...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found