apache/iceberg · error · UnsupportedOperationException

Parser context is not supported

Error message

Parser context is not supported

What it means

The RESTClient default get(..., parserContext) overload does not support a ParserContext argument; passing a non-null context throws UnsupportedOperationException and the call falls back to the plain get. Parser contexts are only honored by clients/overloads that explicitly accept them.

Solutions

  1. Pass null for parserContext and use the plain get overload
  2. Ensure a concrete client implementation supports parser contexts before using this overload
  3. Remove the parserContext argument if response parsing needs no context

Example fix

// before
client.get(path, params, type, headers, handler, parserContext); // non-null context
// after
client.get(path, params, type, headers, handler);
Defensive patterns

Strategy: validation

Validate before calling

if (parserContext != null) {
  throw new IllegalArgumentException("Default RESTClient.get does not support ParserContext");
}

Try / catch

try {
  return client.get(path, params, type, headers, handler, parserContext);
} catch (UnsupportedOperationException e) {
  return client.get(path, params, type, headers, handler);
}

Prevention

When it happens

Trigger: Calling the extended get(path, queryParams, responseType, headers, errorHandler, parserContext) with a non-null parserContext on the default RESTClient; passing a context 'just in case' when it is unnecessary.

Common situations: Copy-pasting code written against a richer HTTP client into one using the RESTClient interface defaults; new API surface used before the concrete client implements it.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/rest/RESTClient.java:108

  default <T extends RESTResponse> T get(
      String path,
      Map<String, String> queryParams,
      Class<T> responseType,
      Supplier<Map<String, String>> headers,
      Consumer<ErrorResponse> errorHandler) {
    return get(path, queryParams, responseType, headers.get(), errorHandler);
  }

  default <T extends RESTResponse> T get(
      String path,
      Map<String, String> queryParams,
      Class<T> responseType,
      Map<String, String> headers,
      Consumer<ErrorResponse> errorHandler,
      ParserContext parserContext) {
    if (parserContext != null) {
      throw new UnsupportedOperationException("Parser context is not supported");
    }
    return get(path, queryParams, responseType, headers, errorHandler);
  }

  default <T extends RESTResponse> T get(
      String path,
      Map<String, String> queryParams,
      Class<T> responseType,
      Supplier<Map<String, String>> headers,
      Consumer<ErrorResponse> errorHandler,
      Consumer<Map<String, String>> responseHeaders) {
    return get(path, queryParams, responseType, headers.get(), errorHandler, responseHeaders);
  }

  default <T extends RESTResponse> T get(
      String path,
      Map<String, String> queryParams,
      Class<T> responseType,

View on GitHub (pinned to 86d9c8fc54)