{"record":{"id":"693b7d4b29762788","repo":"apache/iceberg","slug":"invalid-snapshot-mode-s","errorCode":null,"errorMessage":"Invalid snapshot mode: %s","messagePattern":"Invalid snapshot mode: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java","lineNumber":525,"sourceCode":"    Table table = catalog.loadTable(ident);\n\n    if (table instanceof BaseTable) {\n      TableMetadata loadedMetadata = ((BaseTable) table).operations().current();\n\n      TableMetadata metadata;\n      switch (mode) {\n        case ALL:\n          metadata = loadedMetadata;\n          break;\n        case REFS:\n          metadata =\n              TableMetadata.buildFrom(loadedMetadata)\n                  .withMetadataLocation(loadedMetadata.metadataFileLocation())\n                  .suppressHistoricalSnapshots()\n                  .build();\n          break;\n        default:\n          throw new IllegalArgumentException(String.format(\"Invalid snapshot mode: %s\", mode));\n      }\n\n      return LoadTableResponse.builder().withTableMetadata(metadata).build();\n    } else if (table instanceof BaseMetadataTable) {\n      // metadata tables are loaded on the client side, return NoSuchTableException for now\n      throw new NoSuchTableException(\"Table does not exist: %s\", ident);\n    }\n\n    throw new IllegalStateException(\"Cannot wrap catalog that does not produce BaseTable\");\n  }\n\n  public static LoadTableResponse updateTable(\n      Catalog catalog, TableIdentifier ident, UpdateTableRequest request) {\n    TableMetadata finalMetadata;\n    if (isCreate(request)) {\n      // this is a hacky way to get TableOperations for an uncommitted table\n      Transaction transaction =\n          catalog.buildTable(ident, EMPTY_SCHEMA).createOrReplaceTransaction();","sourceCodeStart":507,"sourceCodeEnd":543,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L507-L543","documentation":"CatalogHandlers.loadTable takes a SnapshotMode (the X-Iceberg-Access-Delegation / snapshot mode selector) and switches over it; if the mode value is not one of the known enum values the default branch throws IllegalArgumentException 'Invalid snapshot mode'.","triggerScenarios":"GET /v1/{prefix}/namespaces/{ns}/tables/{table} with an unrecognized snapshot mode value supplied by the client (e.g. misspelled or a mode added by a newer spec than the server supports).","commonSituations":"Newer client sending a snapshot mode the older server does not know; hand-rolled REST calls with wrong mode strings; config-driven mode selection with a bad value.","solutions":["Use a supported snapshot mode value (e.g. 'all' or 'main' as defined by SnapshotMode) in the request","Upgrade the REST server to a version that knows the mode the client sends","Check client configuration/property that sets the snapshot mode for typos"],"exampleFix":"// before\nGET /v1/ns/tbl?X-Iceberg-Access-Delegation=snaphot\n// after\nGET /v1/ns/tbl?X-Iceberg-Access-Delegation=all","handlingStrategy":"validation","validationCode":"// client: only send known modes\nString mode = cfg.get(\"snapshot-mode\");\nif (!Set.of(\"all\", \"main\").contains(mode)) throw new IllegalArgumentException(\"Unsupported mode: \" + mode);","typeGuard":null,"tryCatchPattern":"try {\n  restClient.get(path + \"?X-Iceberg-Access-Delegation=\" + mode);\n} catch (HttpClientException e) {\n  if (e.status() == 400) { /* retry without snapshot mode */ }\n}","preventionTips":["Only use snapshot mode values defined by the Iceberg REST spec version you target","Keep client and server Iceberg versions compatible","Centralize mode configuration to avoid typos"],"tags":["rest-catalog","snapshot-mode","bad-request","enum"],"backgroundTag":"invalid-enum-value","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"}