apache/iceberg · error · IllegalArgumentException

Invalid file content value: '%s'

Error message

Invalid file content value: '%s'

What it means

fileContentFromJson accepts file content as a numeric int (0=data, 1=positional deletes, 2=equality deletes) or, for backward compatibility with Iceberg <=1.10, the FileContent enum name. Any other string that is not an enum constant triggers this IllegalArgumentException, chaining the original cause.

Source

Thrown at core/src/main/java/org/apache/iceberg/ContentFileParser.java:426

    }

    return partitionData;
  }

  private static FileContent fileContentFromJson(String content) {
    switch (content) {
      case CONTENT_DATA:
        return FileContent.DATA;
      case CONTENT_POSITION_DELETES:
        return FileContent.POSITION_DELETES;
      case CONTENT_EQUALITY_DELETES:
        return FileContent.EQUALITY_DELETES;
      default:
        // In 1.10 and before, file content is serialized as the FileContent enum value
        try {
          return FileContent.valueOf(content);
        } catch (IllegalArgumentException e) {
          throw new IllegalArgumentException(
              String.format("Invalid file content value: '%s'", content), e);
        }
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Change the content value to the integer form: 0, 1, or 2.
  2. Or use the exact FileContent enum name: DATA, POSITION_DELETES, EQUALITY_DELETES.
  3. Regenerate the JSON with the current Iceberg parser to guarantee compatibility.

Example fix

// before
{"content": "POSITION_DELETE"}
// after
{"content": 1}
Defensive patterns

Strategy: validation

Validate before calling

Object c = json.get("content");
boolean ok = (c instanceof Number)
    || (c instanceof String && Set.of("DATA","POSITION_DELETES","EQUALITY_DELETES").contains(c));

Try / catch

try { ContentFileParser.fromJson(node, spec); } catch (IllegalArgumentException e) {
  throw new IllegalArgumentException("unsupported content value", e);
}

Prevention

When it happens

Trigger: ContentFileParser.fromJson encountering a 'content' field with an unrecognized string value (e.g. "delete", "DATA_FILE", lowercase names) that is neither an int nor a valid FileContent enum name.

Common situations: JSON produced by older tooling or other frameworks using different content naming; hand-written JSON; case-sensitivity mistakes (enum names are uppercase).

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/fc78dc9e2e049bea. Report an issue: GitHub.