# Arrayindexoutofboundsexception: 55 Error, no idea what's gone wrong

**URL:** <https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799>\
**Category:** Coding Questions\
**Created:** [August 20, 2018, 6:59pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799 "2018-08-20T18:59:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![12345](https://avatars.discourse-cdn.com/v4/letter/1/ec9cab/32.png) [@12345](https://discourse.processing.org/u/12345)\
**Post date:** [August 20, 2018, 6:59pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799/1 "2018-08-20T18:59:37Z")

</div>

Hi, does anyone know how to fix this error, my sketch works when I use a different svg file but not on other svg files. I can’t work out what might be causing this? This is the error that comes up : arrayindexoutofboundsexception: 55

```processing
timport ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

import processing.serial.*;
import geomerative.*;

Minim minim;
AudioPlayer player;
AudioInput input;

RShape grp;
RPoint[][] pointPaths;

float z = 0;

String inString; // Input string from serial port
String val; // Data received from the serial port
int lf = 10;
Serial myPort;

int sensitivity=100;

boolean ignoringStyles = false;

void setup() 
{   

  
    //fullScreen();
    print (Serial.list());
    size(600, 600, P3D);

      minim = new Minim(this);
      player = minim.loadFile("WIND ONE.mp3");
      input = minim.getLineIn();
        player.play();
    // I know that the first port in the serial list on my mac
    // is always my FTDI adaptor, so I open Serial.list()[0].
    // On Windows machines, this generally opens COM1.
    // Open whatever port is the one you're using.
    String portName = Serial.list()[1];
    myPort = new Serial(this, portName, 9600);
    myPort.bufferUntil(lf);
    
      RG.init(this);
      RG.ignoreStyles(ignoringStyles);
  
      RG.setPolygonizer(RG.ADAPTATIVE);
    
    grp = RG.loadShape("E.svg");
    grp.centerIn(g, 100, 1, 1);
    
    pointPaths = grp.getPointsInPaths();
  
}

void draw()
{
  //z = 10 * sin( frameCount/50.0 * PI);
  
  print(inString);
      background(0);
       loadShape("E.svg").disableStyle(); // Ignore the colors in the SVG
  fill(255); // Set the SVG fill to blue
  stroke(0);

       for(int i = 0; i < player.bufferSize() - 1; i++)
    {
      inString=str(sensitivity*(player.left.get(i)));
    }
      float Random_var=(float(inString)/400)*50;
      translate(300,300,z);
      for(int i = 0; i<pointPaths.length; i++){
    
    translate((random((Random_var))),(random((Random_var))),z);

    if (pointPaths[i] != null) {
      beginShape();
     for(int j = 0; j<pointPaths[i].length; j++){
        vertex(pointPaths[i][j].x, pointPaths[i][j].y);
      }
      endShape();
    }
  }
      
    
  }
  
  void serialEvent(Serial p) { 
  inString = p.readString(); 
}ype or paste code here

```

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [August 21, 2018, 10:07pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799/2 "2018-08-21T22:07:40Z")

</div>

Could you expand on this?

> [@12345](#):
>
> my sketch works when I use a different svg file but not on other svg files.

In addition to that, try to break down your problem into smaller pieces.

In a situation like this, I like to comment out blocks of code until it works again, and then, little by little, re-introduce code until it breaks again.

---

<div class="post-metadata">

**Author:** ![EnhancedLoop7](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/enhancedloop7/32/1040_2.png) [@EnhancedLoop7](https://discourse.processing.org/u/EnhancedLoop7)\
**Post date:** [August 22, 2018, 5:56pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799/3 "2018-08-22T17:56:00Z")

</div>

Hmm, so you are getting an Array Index out of Bound error, meaning that somewhere in your code, you are trying to reference an Array Index, that is too big (or small) (and hence doesn’t exist).

I don’t have Arduino so forgive me for not actually running your code to see exactly what is wrong, but I know that usually these out of bound errors usually happen in for loops because you end up referencing an index that is too high. I would advise you look here:

```auto
for(int i = 0; i < player.bufferSize() - 1; i++)
    {
      inString=str(sensitivity*(player.left.get(i)));
    }

```

here:

`for(int i = 0; i<pointPaths.length; i++){`

And here:

```auto
for (int j = 0; j<pointPaths[i].length; j++){
        vertex(pointPaths[i][j].x, pointPaths[i][j].y);
      }

```

Again, I do not know exactly which line of code is giving you your error, I believe it is on line 55 though, but I do not think that is exactly where your error originated from. So again, I would say to first look at your for loops that are iterating through your arrays, and make sure you aren’t going overboard.

Secondly, I would look at any place that you assign anything to an array, such as:

`vertex(pointPaths[i][j].x, pointPaths[i][j].y);`

Or here:

`if (pointPaths[i] != null) {`

And see if you can find it. Hopefully that can get you started on fixing this problem, and if not, we wouldn’t mind helping out further.

EnhancedLoop7

---

<div class="post-metadata">

**Author:** ![kellyegan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kellyegan/32/18828_2.png) [@kellyegan](https://discourse.processing.org/u/kellyegan)\
**Post date:** [March 15, 2025, 1:53pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799/4 "2025-03-15T13:53:56Z")

</div>

I am having a similar problem. I have barely started my sketch. Just a modification of the example code:

```auto
PShape shape;

void setup() {
  size(640, 480);
  shape = loadShape("shape.svg");
}

void draw() {
  background(220);
  shape(shape, width/2, height/2);
}

```

The svg is very basic. Just a few paths. I have tried loading with files saved from both Illustrator and Inkscape.

---

<div class="post-metadata">

**Author:** ![kellyegan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kellyegan/32/18828_2.png) [@kellyegan](https://discourse.processing.org/u/kellyegan)\
**Post date:** [March 15, 2025, 2:38pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-55-error-no-idea-whats-gone-wrong/2799/5 "2025-03-15T14:38:35Z")

</div>

It seems in my case might be that the files originated inside Illustrator. It took some effort but I was able to get them to load after editing the path (adding handles) in Inkscape and resaving. Resaving alone did nonthing. This stopped the error but they were invisible. Than I edited the stroke color and finally it worked. It seems to have more issues with open paths than closed paths.
