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
- Pass null for parserContext when using BaseHTTPClient
- Use a client implementation that supports ParserContext
- Refactor calling code to not rely on parser-context customization
- 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
- Never pass ParserContext to the default BaseHTTPClient
- Check client capabilities before using optional API extensions
- Keep custom client implementations in sync with REST client interfaces
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
- Header name cannot be empty
- Invalid (NOT_MODIFIED) response for request: method=
- Invalid (null) response body for request
- Parser context is not supported
- Query params are not supported
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)