{"record":{"id":"ffe0b5b279e348c5","repo":"apache/iceberg","slug":"unable-to-process-code-s-type-s-s","errorCode":null,"errorMessage":"Unable to process (code: %s, type: %s): %s","messagePattern":"Unable to process \\(code: (.+?), type: (.+?)\\): (.+?)","errorType":"exception","errorClass":"RESTException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java","lineNumber":282,"sourceCode":"\n  /** Request error handler specifically for create-read-update ops on namespaces. */\n  private static class NamespaceErrorHandler extends DefaultErrorHandler {\n    private static final ErrorHandler INSTANCE = new NamespaceErrorHandler();\n\n    @Override\n    public void accept(ErrorResponse error) {\n      switch (error.code()) {\n        case 400:\n          if (NamespaceNotEmptyException.class.getSimpleName().equals(error.type())) {\n            throw new NamespaceNotEmptyException(\"%s\", error.message());\n          }\n          throw new BadRequestException(\"Malformed request: %s\", error.message());\n        case 404:\n          throw new NoSuchNamespaceException(\"%s\", error.message());\n        case 409:\n          throw new AlreadyExistsException(\"%s\", error.message());\n        case 422:\n          throw createRESTException(error);\n      }\n\n      super.accept(error);\n    }\n  }\n\n  /** Request error handler for drop namespace operations. */\n  private static class DropNamespaceErrorHandler extends NamespaceErrorHandler {\n    private static final ErrorHandler INSTANCE = new DropNamespaceErrorHandler();\n\n    @Override\n    public void accept(ErrorResponse error) {\n      if (error.code() == 409) {\n        throw new NamespaceNotEmptyException(\"%s\", error.message());\n      }\n\n      super.accept(error);\n    }","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java#L264-L300","documentation":"RESTNamespaceErrorHandler.accept(RESTError) maps known REST namespace error codes (400, 404, 409, 422) to typed Iceberg exceptions. For any other HTTP status returned with a REST error payload, it falls through to the base handler, which throws a generic RESTException formatted as 'Unable to process (code: <status>, type: <error type>): <message>'.","triggerScenarios":"A namespace-scoped REST call (create/load/list/delete namespace) where the server replies with an error code outside the mapped set (e.g. 401, 403, 500, 503) and an ErrorResponse body.","commonSituations":"REST catalog server returning 500 on a transient backend failure; auth proxy responding 401; load balancer returning 502/503 for namespace operations.","solutions":["Inspect the code and type fields in the message to identify the server-side failure","Check server logs for the corresponding request failure","Add handling/retry for the specific status (e.g. retry on 502/503, fix credentials on 401)","Upgrade/patch the server to return a spec-defined error code for the condition"],"exampleFix":"// before\ntry { catalog.createNamespace(ns); } catch (RESTException e) { /* Unable to process (code: 500 ...) */ }\n// after\ntry {\n  catalog.createNamespace(ns);\n} catch (RESTException e) {\n  if (e.getMessage().contains(\"code: 503\")) { retry(); } else { throw e; }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { catalog.loadNamespace(ns); } catch (RESTException e) { /* inspect code/type in message; retry transient 5xx */ }","preventionTips":["Deploy a spec-conformant REST server that returns mapped status codes","Monitor for gateway errors between client and server","Retry idempotent reads on transient 5xx codes"],"tags":["rest","http","namespace","error-mapping"],"backgroundTag":"api-error-response","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"}