Kotlin / Kotlin/dataframe

Commons IO NoSuchMethodError when reading CSV

Open
#1,620 1 comment 0 reactions 1 assignee View on GitHub

@Jolanrensen is already working on this.

Since Dec 6, 2025.

bug Tooling
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Calling

%use adventOfCode, dataframe
DataFrame.readDelimStr(
    exampleInput,
    hasFixedWidthColumns = true,
)

(or just a normal DataFrame.readCsv())

in notebooks gives me:

java.lang.NoSuchMethodError: 'org.apache.commons.io.input.BOMInputStream$Builder org.apache.commons.io.input.BOMInputStream.builder()'
	at org.jetbrains.kotlinx.dataframe.io.CommonKt.skippingBomCharacters(common.kt:89)
	at org.jetbrains.kotlinx.dataframe.impl.io.ReadDelimDeephavenKt.readDelimImpl(readDelim.kt:145)
	at org.jetbrains.kotlinx.dataframe.io.ReadDelimStrKt.readDelimStr(readDelimStr.kt:51)
	at org.jetbrains.kotlinx.dataframe.io.ReadDelimStrKt.readDelimStr$default(readDelimStr.kt:33)
	at Line_19_jupyter.<init>(Line_19.jupyter.kts:7) at Cell In[5], line 7
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)

probably because we have implementation(libs.commonsIo) and not api() or the version was/wasn't bumped?

========================================================================================

Fix Commons IO version conflict causing NoSuchMethodError in CSV/Delim readers

Reading CSV/TSV/delimited data can fail at runtime with NoSuchMethodError when an older commons-io version is present on the classpath.

Problem

The CSV/Delim reader calls BOMInputStream.builder() while skipping BOM characters:

public fun InputStream.skippingBomCharacters(): InputStream =
    BOMInputStream.builder()
        .setInputStream(this)
        .setByteOrderMarks(...)
        .setInclude(false)
        .get()

This method is available only in newer versions of Apache Commons IO. If another dependency brings an older commons-io version, reading CSV or delimited input can fail with:

java.lang.NoSuchMethodError:
'org.apache.commons.io.input.BOMInputStream$Builder
org.apache.commons.io.input.BOMInputStream.builder()'

Known reproduction:

%use adventOfCode, dataframe

DataFrame.readDelimStr(
    exampleInput,
    hasFixedWidthColumns = true,
)

The same issue may affect regular CSV reading as well, because the failure happens in shared BOM-skipping code used by delimited readers.

Why This Matters

This is a runtime dependency conflict, not a parsing error. The DataFrame code is compiled against a Commons IO version that contains BOMInputStream.builder(), but the runtime may resolve an older version.

This can break very common entry points such as:

DataFrame.readCsv(...)
DataFrame.readDelimStr(...)

especially in environments where multiple dependency descriptors or libraries are combined and dependency resolution is less explicit.

Suggested Investigation

Check whether the published artifacts and descriptors guarantee a compatible Commons IO version at runtime.

Things to verify:

  • commons-io version used by DataFrame is new enough for BOMInputStream.builder().
  • DataFrame CSV/Delim artifacts publish the dependency in a way that makes it available at runtime.
  • Combined dependency environments do not silently select an older Commons IO version.
  • %use dataframe / descriptor-based environments, if still supported for this release, resolve a compatible Commons IO version when used together with other libraries.

Possible Fix Options

Preferred options:

  1. Ensure DataFrame forces or declares a compatible Commons IO runtime dependency in all relevant published artifacts/descriptors.
  2. Add dependency constraints or descriptor-level version alignment so older transitive Commons IO versions do not win.
  3. Replace usage of BOMInputStream.builder() with an API compatible with the minimum Commons IO version that DataFrame may realistically encounter.

The best fix depends on whether DataFrame wants to require a newer Commons IO version or avoid relying on the newer API.

Acceptance Criteria

  • The reproduction no longer fails with NoSuchMethodError.
  • DataFrame.readCsv(...) and DataFrame.readDelimStr(...) work when DataFrame is used together with another library that brings Commons IO transitively.
  • A regression test or integration test covers a classpath with an older transitive Commons IO candidate, if feasible.
  • Published artifact metadata/descriptors are checked so runtime dependency resolution is correct.
  • If the fix is descriptor-specific, the issue clearly documents which environments are covered.

Release Decision

This should be included in the release if descriptor-based or interactive dependency environments are part of the release scope, because it breaks basic CSV/Delim reading at runtime.

For plain Gradle/Maven usage, this is still a high-priority compatibility issue, but it is only a release blocker if users can realistically hit the older Commons IO version through normal dependency resolution.

Recommended release status: include as release hardening, and treat as a blocker if the release advertises CSV/Delim support in combined descriptor environments.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.