java.lang.IndexOutOfBoundsException: index (-1) must not be negative

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Atlassian JIRA by Gustavo Refosco [Atlassian], 1 year ago
index (-1) must not be negative
via Atlassian JIRA by Gustavo Refosco [Atlassian], 1 year ago
index (-1) must not be negative
via GitHub by ScottKillen
, 9 months ago
index (8) must be less than size (8)
via GitHub by DietmarKrause
, 1 year ago
index (32767) must be less than size (3)
via GitHub by gissuebot
, 2 years ago
index (-236637701) must not be negative
java.lang.IndexOutOfBoundsException: index (-1) must not be negative
at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:301)
at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:280)
at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:91)
at com.atlassian.stash.internal.branch.model.version.BranchVersion.componentAt(BranchVersion.java:155)
at com.atlassian.stash.internal.branch.model.version.BranchVersion.compareTo(BranchVersion.java:67)
at com.atlassian.stash.internal.branch.model.version.VersionedBranch.compareTo(VersionedBranch.java:84)
at com.atlassian.stash.internal.branch.model.version.VersionedBranch$4.apply(VersionedBranch.java:77)
at com.atlassian.stash.internal.branch.model.version.VersionedBranch$4.apply(VersionedBranch.java:74)
at com.google.common.base.Predicates$AndPredicate.apply(Predicates.java:338)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:649)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at com.google.common.collect.Lists.newArrayList(Lists.java:138)
at com.google.common.collect.Lists.newArrayList(Lists.java:119)
at com.google.common.collect.NaturalOrdering.sortedCopy(NaturalOrdering.java:57)
at com.atlassian.stash.util.Chainable.sort(Chainable.java:102)
at com.atlassian.stash.internal.branch.model.SimpleBranchModel.getMergePath(SimpleBranchModel.java:72)
at com.atlassian.stash.internal.branch.automerge.DefaultAutoMergeService$$anonfun$getDownstreamBranches$2.apply(DefaultAutoMergeService.scala:44)
at com.atlassian.stash.internal.branch.automerge.DefaultAutoMergeService$$anonfun$getDownstreamBranches$2.apply(DefaultAutoMergeService.scala:44)
at com.atlassian.stash.internal.branch.automerge.DefaultAutoMergeService.getDownstreamBranches(DefaultAutoMergeService.scala:44)
at com.atlassian.stash.internal.branch.automerge.DefaultAutoMergeService.getAutoMerge(DefaultAutoMergeService.scala:16)
at com.atlassian.stash.internal.branch.automerge.rest.AutoMergeResource.getMergePath(AutoMergeResource.java:59)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25)
at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:86)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77)
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100)
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69)
at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:33)
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84)
at com.hazelcast.web.WebFilter.doFilter(WebFilter.java:446)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.lang.Thread.run(Thread.java:744)

Users with the same issue

Once, 5 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.