{"record":{"id":"088c4d47ad2298af","repo":"apache/iceberg","slug":"returning-response-headers-is-not-supported","errorCode":null,"errorMessage":"Returning response headers is not supported","messagePattern":"Returning response headers is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/RESTClient.java","lineNumber":131,"sourceCode":"  default <T extends RESTResponse> T get(\n      String path,\n      Map<String, String> queryParams,\n      Class<T> responseType,\n      Supplier<Map<String, String>> headers,\n      Consumer<ErrorResponse> errorHandler,\n      Consumer<Map<String, String>> responseHeaders) {\n    return get(path, queryParams, responseType, headers.get(), errorHandler, responseHeaders);\n  }\n\n  default <T extends RESTResponse> T get(\n      String path,\n      Map<String, String> queryParams,\n      Class<T> responseType,\n      Map<String, String> headers,\n      Consumer<ErrorResponse> errorHandler,\n      Consumer<Map<String, String>> responseHeaders) {\n    if (null != responseHeaders) {\n      throw new UnsupportedOperationException(\"Returning response headers is not supported\");\n    }\n\n    return get(path, queryParams, responseType, headers, errorHandler);\n  }\n\n  <T extends RESTResponse> T get(\n      String path,\n      Map<String, String> queryParams,\n      Class<T> responseType,\n      Map<String, String> headers,\n      Consumer<ErrorResponse> errorHandler);\n\n  default <T extends RESTResponse> T post(\n      String path,\n      RESTRequest body,\n      Class<T> responseType,\n      Supplier<Map<String, String>> headers,\n      Consumer<ErrorResponse> errorHandler) {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/RESTClient.java#L113-L149","documentation":"The RESTClient default get(..., responseHeaders) overload cannot return response headers; passing a non-null Consumer<Map<String,String>> throws UnsupportedOperationException. Response-header capture requires a concrete client that supports it.","triggerScenarios":"Calling get(path, queryParams, responseType, headers, errorHandler, responseHeaders) with a non-null responseHeaders consumer on the default RESTClient interface; attempting to read headers like x-iceberg-access-delegation via the default overload.","commonSituations":"Code needing header metadata (e.g. access delegation hints) written against the interface default; mixing overloads when refactoring calls.","solutions":["Use the get overload without the responseHeaders consumer if headers are not needed","Use a concrete client implementation that supports response headers","Capture needed information from the response body instead of headers when possible"],"exampleFix":"// before\nclient.get(path, params, type, headers, handler, hdrs -> save(hdrs));\n// after\nclient.get(path, params, type, headers, handler); // or use a header-capable client","handlingStrategy":"validation","validationCode":"if (responseHeaders != null) {\n  throw new IllegalArgumentException(\"Default RESTClient.get cannot return response headers\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return client.get(path, params, type, headers, handler, responseHeaders);\n} catch (UnsupportedOperationException e) {\n  return client.get(path, params, type, headers, handler);\n}","preventionTips":["Use the header-less get overload unless a header-capable client is in place","Derive needed metadata from the response body when possible","Verify concrete client capabilities before using extended overloads"],"tags":["rest-client","unsupported-operation","api"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}