apache/iceberg · error · UnsupportedOperationException

Parser context is not supported

Error message

Parser context is not supported

What it means

BaseHTTPClient.execute rejects any non-null ParserContext: this HTTP client implementation does not support parser contexts and throws UnsupportedOperationException unconditionally. ParserContext is an optional parsing-customization mechanism; the default REST client does not implement it, so calls through the get/post overloads accepting a context always fail.

Solutions

  1. Pass null for parserContext when using BaseHTTPClient
  2. Use a client implementation that supports ParserContext
  3. Refactor calling code to not rely on parser-context customization
  4. File/track an issue to add ParserContext support to the HTTP client

Example fix

// before
client.post(path, body, responseType, errorHandler, headers, parserContext);
// after
client.post(path, body, responseType, errorHandler, headers, null);
Defensive patterns

Strategy: type-guard

Validate before calling

if (parserContext != null && client instanceof BaseHTTPClient) {
  throw new IllegalArgumentException("This client does not support ParserContext");
}

Type guard

boolean supportsParserContext(Object client) {
  return !(client instanceof BaseHTTPClient);
}

Try / catch

try {
  client.post(path, body, responseType, errorHandler, headers, parserContext);
} catch (UnsupportedOperationException e) {
  // retry without parserContext
}

Prevention

When it happens

Trigger: Calling get/post (or the execute overload shown) on BaseHTTPClient with a non-null parserContext argument, e.g. custom catalog/extension code passing parsing config through the REST session.

Common situations: Custom catalog or extension code supplying a ParserContext to the standard REST client; swapping client implementations where the new one lacks ParserContext support.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/rest/BaseHTTPClient.java:171

      String path,
      Map<String, String> queryParams,
      Map<String, String> headers,
      Object body);

  protected abstract <T extends RESTResponse> T execute(
      HTTPRequest request,
      Class<T> responseType,
      Consumer<ErrorResponse> errorHandler,
      Consumer<Map<String, String>> responseHeaders);

  protected <T extends RESTResponse> T execute(
      HTTPRequest request,
      Class<T> responseType,
      Consumer<ErrorResponse> errorHandler,
      Consumer<Map<String, String>> responseHeaders,
      ParserContext parserContext) {
    if (null != parserContext) {
      throw new UnsupportedOperationException("Parser context is not supported");
    }

    return execute(request, responseType, errorHandler, responseHeaders);
  }
}

View on GitHub (pinned to 86d9c8fc54)