I am encountering a java.lang.ArrayIndexOutOfBoundsException when trying to load a specific CSV file using Aspose.Cells for Node.js via Java by using new aspose.Workbook(csvFilePath, aspose.getCsvLoadOptions())
I have tested this with different versions and found the following results:
v23.4: Works correctly (No error).
v25.10: Fails with java.lang.ArrayIndexOutOfBoundsException.
Since this works in the older version, it appears to be a regression introduced in recent updates.
Stack Trace:
Error creating class java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at com.aspose.cells.k1.a(Unknown Source)
at com.aspose.cells.k1.parseObject(Unknown Source) at com.aspose.cells.z80.a(Unknown Source)
at com.aspose.cells.z80.a(Unknown Source) at com.aspose.cells.z80.a(Unknown Source)
at com.aspose.cells.z80.a(Unknown Source) at com.aspose.cells.w7.b(Unknown Source)
at com.aspose.cells.w7.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at node.MethodCallBaton.newInstance(MethodCallBaton.java:8)
===============
I have attached the CSV file that causes this issue. Could you please investigate this? 20251125_sample1.zip (237 バイト)
Summary
You receive a java.lang.ArrayIndexOutOfBoundsException when loading a specific CSV file with Aspose.Cells for Node.js (Java backend). The same file loads without error in an older version of the library, which suggests that the CSV parsing behavior has changed in newer releases.
Why it happens
The exception originates from the internal CSV parser (com.aspose.cells.k1.parseObject). It occurs when the parser tries to read a column that does not exist in the current row (e.g., “Index 3 out of bounds for length 3”). Typical causes are:
Rows that contain fewer fields than the header row.
Inconsistent delimiters, trailing delimiters, or mixed delimiter characters.
Quoted fields that embed the delimiter or line‑break characters, leading to a mis‑count of columns.
Newer versions may apply stricter validation of column counts, causing the parser to throw an exception where older versions silently accepted the data.
What to do next
Verify the CSV content
Open the file in a plain‑text editor.
Ensure every data row has the same number of delimiters as the header row.
Look for trailing commas, mixed delimiters, or quoted fields that contain commas or new‑line characters.
Load the file with explicit CSV options (if the API provides them)
// Create explicit CSV load options
com.aspose.cells.CsvLoadOptions csvOpts = new com.aspose.cells.CsvLoadOptions();
// Adjust the delimiter if needed
csvOpts.setDelimiter(',');
// Optionally disable automatic numeric conversion
csvOpts.setConvertNumericData(false);
// Optionally treat all cells as text
csvOpts.setDetectColumnTypes(false);
// Load the workbook
com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook("path/to/20251125_sample1.csv", csvOpts);
If the workbook loads successfully, the issue is related to the default parsing settings.
Confirm the behavior with the pure Java library Create a small Java console project that references the aspose-cells-<version>.jar (the same JAR used by the Node.js wrapper) and run the code from step 2. If the exception still occurs, the problem lies in the core Aspose.Cells for Java library.
Review change information Examine the release notes or change log for Aspose.Cells versions released after the one that works for you. Look for entries mentioning CSV parsing, column‑count validation, or related exceptions.
Gather details for further investigation
Java runtime version and operating system.
Node.js version and the exact NPM package name/version.
A few representative rows from the CSV that trigger the error.
Results of step 3 (whether the pure Java library reproduces the issue).
Having this information ready will help you or the library maintainers pinpoint whether the behavior is a regression and identify an appropriate fix.
Temporary workaround Pre‑process the CSV (e.g., with a small script) to ensure every row has the same number of columns or to replace problematic delimiters with a character that does not appear in the data.
*Alternatively, read the file as plain text, split it manually, and populate a workbook programmatically.
Next‑step checklist
Open the CSV and confirm column consistency.
Try loading it with explicit CsvLoadOptions as shown above.
Test the same code using the standalone Aspose.Cells Java JAR.
Look for relevant changes in the library’s release notes.
Collect the environment and CSV details; if the problem persists, consider escalating it to the library’s maintainers with the gathered information.
The explanation is based on typical CSV‑parsing issues; please verify the behaviour in your environment and provide additional details if needed.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
We require thorough evaluation on the exception “java.lang.ArrayIndexOutOfBoundsException” when loading your CSV with Aspose.Cells for Node.js via Java. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNODEJSJAVA-78
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Could you tell me how you deployed the CustomParser class? What version of Java and Java Bridge did you use? I did a clean install of v25.10 on Windows for testing, and the Java Bridge version installed was 0.16.2. I also tested Java 1.8 and Java 22. Thanks.
@Nick.Liu
Thank you for looking into it.
I can confirm the issue occurs even without our custom parser.
The issue occurs if you use aspose.cells@25.10 . The issue doesn’t occurs with aspose.cells@25.7 .
@coopelkatz
By testing the following sample code on the latest version v25.10, we were able to run the program normally without any exceptions.
var aspose = aspose || {};
aspose.cells = require("aspose.cells");
console.log(aspose.cells.CellsHelper.getVersion());
var workbook = new aspose.cells.Workbook("20251125_sample1.csv");
console.log(
workbook.getWorksheets().get(0).getCells().get(0, 0).getStringValue()
);
The output:
25.10.0
COL_ID
If you still have questions, would you like to provide a detailed description of your abnormal information? If you could provide screenshots and highlight the errors, it would be very helpful for us to locate the issue. We will check it soon.
@coopelkatz
I tried installing the aspose.cells@25.10.0 package using your package.json file on the same version of Node.js and JDK, but it didn’t work(Compilation error). So I changed the java-bridge version as follows:
“java”: “0.13.0” => “java”: “0.16.2”, the installation works and the program works fine.
I suggest you reinstall aspose.cells@25.10.0 in a new directory using the updated package.json.
@coopelkatz
Thank you for providing the detailed steps, which enabled us to reproduce the issue in the Japanese environment . We will fix it as soon as possible.