Questions tagged [indexoutofboundsexception]

An exception that occurs when you attempt to access an object that is outside the boundaries of the container. Common containers are arrays or array-based objects. This is a language-independent tag.

Filter by
Sorted by
Tagged with
0 votes
0 answers
43 views

Trying to purposely throw an ArrayIndexOutOfBoundsException

I'm very, very new to coding and currently taking a class for Java. For our most recent assignment, we have to purposely throw several different Built-in Exceptions, even though to my understanding ...
0 votes
0 answers
34 views

why does the compiler give me list index out of bounds error?

x = int(input("Row :")) y = int(input("Column:")) z = y+x\*8-9 board = \[\] def ShowBoard(): j = 0 for i in range(64): if i == z: board.append('0') ...
0 votes
0 answers
41 views

How do i fix this error IndexError: index 30 is out of bounds for axis 1 with size 30?

I am trying to carry out feature selection on the Winscosin breast cancer dataset from Kaggle. The dataset has 32 colunms. I removed the iD column and i have 31 colunms left. Counting from 1. The ...
0 votes
1 answer
93 views

IndexOutOfBoundsException: Index: 2, Size: 2 at recyclerview getItemViewType when updating database

i have an adapter with 5 viewTypes, with options to edit the list such as add, delete, check, unCheck, hide and show items. when i press delete an item (the item is deleted from room database and the ...
0 votes
1 answer
61 views

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 Error in Kotlin

I am trying to build an currency exhanger app using an API. When I try to get the first currency, i get indexOutOfBounds Exception. I know that exchangeDetails Array empty is and i cannot reach to an ...
1 vote
0 answers
16 views

Index out of Range in Self - BERT Model Tuning Pytorch

I am working on training the BERT Model for Pytorch. I'm quite new to Pytorch as well. My code as replicated from: https://towardsdatascience.com/text-classification-with-bert-in-pytorch-887965e5820f ...
  • 11
0 votes
1 answer
28 views

StringIndexOutofBoundsException when trying to setBackgroundColor using a variable inside an Adapter, why?

I have the following binding method: override fun onBindViewHolder(holder: bomViewHolder, position: Int) { val color=ListTheColorTone[position].color holder.cardBlack.setCardBackgroundColor(Color....
0 votes
1 answer
61 views

Issues filling an array in Java

I am trying to fill an array with the unique values from another file. This file has about 20 integers total, 10 are unique and 10 are copies. The user inputs the size of the array and name of the ...
0 votes
0 answers
45 views

Instance Segmentation Using Mask R-CNN on Custom Dataset IndexError

I am working on semantic segmentation and I came across Instance Segmentation Using Mask R-CNN on Custom Dataset by Code With Aarohi. I met an error. This is the snippet of the code related to the ...
0 votes
0 answers
7 views

Storing Values in a for loop, Index 400 is out of bounds

I am doing a 100 iteration for loop and I have gotten the code to work by printing out the value at each iteration. However, I want to vectorise these values but each time I do this it comes up with ...
0 votes
0 answers
26 views

java indexoutofboundexpection in using grep and awk

I have a file containing lines with the format of a,b,c,d,e,f. I wrote the following Java code to return the list myextracting b,c,d,e,f by looking for b as key. public static List<String> ...
  • 51
1 vote
0 answers
53 views

Android app IndexOutOfBoundsException on PackedIntVector

i am developing an Android app that communicates with Bluetooth sending and receiving raw commands on byte array. Randomly the app crashes right after i send some of this command, with the following ...
  • 61
-1 votes
1 answer
54 views

How do I troubleshoot an OutOfBoundsException error when trying to get initials from a full name in Java?

University computer science major here. I'm using zyBooks for my Object-Oriented Programming class. I'm stuck on an error when I'm trying to work with substrings and whatnot when asked to derive ...
-1 votes
1 answer
34 views

Bubble Sort code : Exception in main thread

public class Main { public static void main(String[] args){ int nums[] = {9,8,4,5,6,7}; int temp=0; for(int i=0;i<nums.length;i++){ for(int j=0;j<nums....
0 votes
0 answers
12 views

Error in files[[i]] : subscript out of bounds

It shows subscript out of bound and then error in tmp . How to resolve this data <- list() for (i in 1:length(files)) { data[[i]] <- readRDS(files[[i]]) } Error in files[[i]] : subscript out of ...
0 votes
0 answers
51 views

Fatal Exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

I'm having a crash with high occurrence. I didn't find any trace of it. Somehow, I managed to know that after recreating an activity I fill recyclerView with my static list. Here's the crash coming ...
  • 1,160
0 votes
0 answers
37 views

Getting index out of bounds error trying to make a method that adds an int to an array in java

Doing some school stuff and I basically need to create a Method that "pushes" an integer to an array at the last position (basically recreating the Stack.push() method). public class ...
  • 3
1 vote
3 answers
74 views

Java IndexOutOfBounds when trying to get a previous entry in a List

I'm working on a question where you are supposed return n rows of pascals triangle given and int n and return it as a List of Lists. However I'm getting an index out of bounds exception when I try to ...
0 votes
0 answers
22 views

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3

I'm trying to write a program that prints out the amount of words that have more than 5 characters. I think my code is right, however, I'm running into an index out of bounds error. I have no clue ...
  • 1
-3 votes
1 answer
61 views

How do I fix this indexOutOfBoundsException?

I have been stuck for hours trying to figure out why my code has an index out of bounds exception, and how to fix it. The error occurs in the column calculations for val and curVal. In my code, it ...
0 votes
0 answers
62 views

I find a problem with removing elements from list in nested "for loop"

I have this problem to solve: Your school wants to hold a competition with the largest number of teams, so that each team consists of two students, provided that the average marks of the team (the two ...
0 votes
1 answer
63 views

Getting Index Out of Bounds Error When Trying to add Elements to a new 2D arraylist

I'm trying to implement the graph ADT in java, and for some reason even though I can add vertices to my 1D arraylist without issue, however I keep getting "Index 0 out of bounds for length 0&...
  • 35
0 votes
1 answer
90 views

Why do both j-- and --j throw exceptions in this LINQ code, but j - 1 does not?

I'm new to C# and practising by writing a solution to the classic 100 doors problem. The below (and probably bad) code solves the problem: internal class Program { private static void Main(string[]...
  • 1,698
0 votes
0 answers
109 views

Handle RecyclerView adapter position inside a delayed listener

How should we handle the adapter position inside a delayed(probably) listener callback of Glide when the size of the list is changed before the ballcack is received? Error: Caused by: java.lang....
-2 votes
2 answers
43 views

String index out of bounds but cant figure out why

So I'm working on this code for practice and its supposed to take all the numbers between 2 "-"s and add them together. I'm supposed to convert the strings to ints as part of the problem. (...
  • 1
0 votes
0 answers
10 views

Is there is any physical shop available for adult toys in jaipur?

for privacy concern .Indians have just recently begun to discuss their sexual desires openly, despite the fact that sexuality is an essential component of our lives. so that i can buy the toys for my ...
0 votes
1 answer
52 views

Python Loop Why is this index out of bounds

Hi I'd like to scan a picture for a certain color. The array seems to be to big although -1 is added. The solution might be simple but I need some help here. (the width of the image is 856 px) THX img ...
0 votes
0 answers
18 views

How do I fix this index out of bounds error? [duplicate]

This program is supposed to encrypt a string by injecting a random amount characters, followed by a key between each letter in the user chosen text. I realize that my code is flawed, as the decrypt ...
  • 11
0 votes
1 answer
296 views

IndexError: index 1 is out of bounds for axis 0 with size 1 when using Pandas to covert CSV colums to lists

Trying to make a relatively simple script to help automate some comment writing I have to do. I'm playing around with how to structure and interact with the data and decided to try using Pandas since ...
-1 votes
1 answer
37 views

I'm getting the error ArrayIndexOutOfBoundsException: index -25 out of bonds for length 16

This is my current code for a program to find the maximum subarray. I am getting the out of bounds error for 3 lines: I'm getting the error ArrayIndexOutOfBoundsException: index -25 out of bonds for ...
-2 votes
1 answer
50 views

Can anybody explain why use of i>0 after && operator giving index out of bound exception while using it before isn't

enter image description here > this is giing arrayIndexOutOfBound Exception ** for(int i=0; i< arr.length; i++){ start =0; if((arr[i]==arr[i-1]) &...
-1 votes
1 answer
61 views

Python: index 4557 is out of bounds for axis 0 with size 4557

I am using lstm for weather prediction, in google colab using python and tensorflow & panda. The snippet of code that gives error is in the creation of univariate model as follows(image attached ...
0 votes
1 answer
25 views

How do I make it so that java stops converting my char(s) to other numerical values

For this project, we have to make a 2D char array that mimics the seats on a plane(Ex: 1 A B C D 2 A B C D), I'm using a scanner to ask the user for the seat that they want to reserve so I take the ...
0 votes
1 answer
193 views

Counting occurrences of an array element - Index out of bounds error but the index number and out of bounds length are the same number?

So I'm having some issues with code I'm writing for an assignment and it's kinda driving me crazy. It's my first semester and I've never done coding before, so I know I still have heaps to learn. ...
  • 19
0 votes
0 answers
32 views

Creating magicsquare, out of bounds error [duplicate]

I am creating a magicsquare in java and have been given the following pseudocode: > Create a 2 dimensional array of size n by n and set all values to be 0 Set x = 1, y = (n+1)/2 (row 1 and column (...
0 votes
0 answers
51 views

Julia BoundsError Debugging

I am trying to write a function in Julia, which tests, whether to given Lie algebras of common dimension are isomorphic or not. What exactly a Lie algebra is shouldn't be important, all you need to ...
  • 1
0 votes
1 answer
404 views

IndexError: single positional indexer is out-of-bounds (iloc[1: , :])

This will be tricky, but I need your help. To sum up, my coworker in charge of data left, and there is an unsolved bug in his Python requests. I have close to 0 knowledge of this language, and I didn'...
  • 11
0 votes
2 answers
113 views

Comparison in pattern matching in OCaml

I want to write a function set which changes the index i in the 'a array a to the value 'a v and raise an invalid_argument exception if i is bigger then the length-1 of the array. I know that this can ...
0 votes
2 answers
788 views

runtime error: addition of unsigned offset/UndefinedBehaviorSanitizer: undefined-behavior

I am not able to find where is my vector going out of bound. This is solution of leetcode question 695. Error: Line 1034: Char 34: runtime error: addition of unsigned offset to 0x610000000040 ...
0 votes
1 answer
718 views

java.lang.IndexOutOfBoundsException: Index 16 out of bounds for length 10 Error

I encountered the following error during the posting paging process. I don't even use an array, but I don't know why I get this error. How can I solve this? BoardCriteria is an object that stores the ...
  • 1
0 votes
2 answers
322 views

index 4 is out of bounds for 4 length

package dsa450; import java.util.*; public class countInversion { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter the ...
1 vote
2 answers
867 views

How to return data from inside of addOnSuccessListener{} method in Kotlin? [duplicate]

I am trying to get user data from Firebase Firestore database , I am intended to get info of user who is currently logged in. Now for make this information accessible from other Classes I created get ...
4 votes
1 answer
721 views

Compose BottomSheetScaffold IndexOutOfBoundsException application crash

I searched for a solution related to this issue but found nothing. I solved the problem so I'm posting the problem and the solution here with goal of helping someone. Problem description After ...
  • 441
2 votes
5 answers
641 views

Array index out of bounds error even though the indices are within the array length

I was trying to write a java program where every digit of an input integer is printed in words. For example: input 123 should produce an output "one two three". I wrote the following program ...
0 votes
2 answers
60 views

Why do I need to write duplicate condition in this while loop?

I'm working on the code returns the maximum number of consecutive 1's in the array. I used two while loops for this code. public int findMaxConsecutiveOnes(int[] nums) { int maximum = 0; int i ...
  • 1
0 votes
0 answers
63 views

Python Index is out of bounds

I am cleaning up data in a .txt file. I use 3 different .txt. files to analyze and clean up three different constructs. The .txt files all have 10 respondents, the first and the last have 17 answers ...
  • 1
-3 votes
1 answer
83 views

IndexOutOfBoundsException issue in java arraylist

The line in which the error occurs is indicated. The program consists of searching for the repeated characters and saving them in a list. In that list of type "letter", the letter will be ...
-1 votes
1 answer
196 views

Visual Studio C# view which index throws System.IndexOutOfRangeException [closed]

So I have code that loops through a 2D array and assigns it a value from a 1D array in my C# program in Visual Studio. When I execute it I get an "index was outside the bounds of array" ...
0 votes
3 answers
100 views

OutOfMemoryError is dangerous, but why more dangerous than other exceptions?

Conventional wisdom, on this site and elsewhere, is to not catch java.lang.OutOfMemoryError, except maybe for cleaning up, and just let the JVM crash and be restarted. The reason given for this is ...
1 vote
1 answer
32 views

Append CellType Index Out Of Range Error Swift

After appending a new cellType my locationTableViewCell is giving an error at let place = places[indexPath.row] while entering text inside the text field search bar. private func locationTableViewCell(...

1
2 3 4 5
57