{"record":{"id":"abde74c7c02bf93d","repo":"apache/iceberg","slug":"received-a-request-with-a-relative-path-and-no-bas","errorCode":null,"errorMessage":"Received a request with a relative path and no base URI: %s","messagePattern":"Received a request with a relative path and no base URI: (.+?)","errorType":"validation","errorClass":"RESTException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/HTTPRequest.java","lineNumber":133,"sourceCode":"  /**\n   * Returns the {@link ObjectMapper} to use for encoding the request body. The default is {@link\n   * RESTObjectMapper#mapper()}.\n   */\n  @Value.Default\n  default ObjectMapper mapper() {\n    return RESTObjectMapper.mapper();\n  }\n\n  @Value.Check\n  default void check() {\n    if (path().startsWith(\"/\")) {\n      throw new RESTException(\n          \"Received a malformed path for a REST request: %s. Paths should not start with /\",\n          path());\n    }\n\n    if (baseUri() == null && !hasAbsolutePath()) {\n      throw new RESTException(\n          \"Received a request with a relative path and no base URI: %s\", path());\n    }\n  }\n\n  private boolean hasAbsolutePath() {\n    return path().startsWith(\"https://\") || path().startsWith(\"http://\");\n  }\n}\n","sourceCodeStart":115,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/HTTPRequest.java#L115-L142","documentation":"HTTPRequest validates itself before sending a REST request. A request whose path is relative (not starting with http:// or https://) must be resolved against a base URI supplied by the catalog configuration; if no base URI is set and the path itself is not absolute, the request cannot be routed, so a RESTException is thrown during the check().","triggerScenarios":"Calling RESTClient/HTTPRequest with a relative path like 'v1/namespaces' while the catalog's uri property is null or unset; constructing an HTTPRequest manually without a base URI; misconfigured REST catalog where 'uri' is missing from catalog properties.","commonSituations":"Deploying a Spark/Flink job with an incomplete catalog config (missing warehouse/uri), building a custom REST catalog client programmatically and forgetting to set the base endpoint, or typos in configuration keys so the URI never loads.","solutions":["Set the 'uri' property in the REST catalog configuration to an absolute HTTP(S) endpoint","Use an absolute URL as the request path if no base URI applies","Verify the config map/properties actually contain the base URI key (watch for typos)","If constructing HTTPRequest directly, pass a non-null baseUri"],"exampleFix":"// before\ncatalog = CatalogLoader.load(\"prod\", ImmutableMap.of(\"type\", \"rest\"), hadoopConf);\n// after\ncatalog = CatalogLoader.load(\"prod\", ImmutableMap.of(\"type\", \"rest\", \"uri\", \"https://rest.catalog.example.com\"), hadoopConf);","handlingStrategy":"validation","validationCode":"String uri = conf.get(CatalogProperties.URI);\nif (uri == null || !(uri.startsWith(\"http://\") || uri.startsWith(\"https://\"))) {\n  throw new IllegalArgumentException(\"REST catalog requires an absolute http(s) 'uri' property\");\n}","typeGuard":"boolean hasUsableTarget(String path, java.net.URI baseUri) {\n  return baseUri != null || path.startsWith(\"http://\") || path.startsWith(\"https://\");\n}","tryCatchPattern":"try {\n  return client.post(path, body, Type.class, headers, handler);\n} catch (RESTException e) {\n  if (e.getMessage().contains(\"relative path and no base URI\")) {\n    throw new IllegalStateException(\"Catalog 'uri' is not configured\", e);\n  }\n  throw e;\n}","preventionTips":["Always set the 'uri' catalog property when using the REST catalog","Validate catalog configuration at startup before issuing requests","Use CatalogLoader rather than hand-constructing HTTPRequest objects","Watch for typos in property keys so the URI actually loads"],"tags":["rest-catalog","configuration","url"],"backgroundTag":"invalid-url-format","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"}