{"record":{"id":"da2faed6ff43be56","repo":"apache/iceberg","slug":"cannot-find-dynamo-table-s","errorCode":null,"errorMessage":"Cannot find Dynamo table %s","messagePattern":"Cannot find Dynamo table (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbLockManager.java","lineNumber":161,"sourceCode":"      dynamo.describeTable(DescribeTableRequest.builder().tableName(tableName).build());\n      return true;\n    } catch (ResourceNotFoundException e) {\n      return false;\n    }\n  }\n\n  private void checkTableActive(String tableName) {\n    try {\n      DescribeTableResponse response =\n          dynamo.describeTable(DescribeTableRequest.builder().tableName(tableName).build());\n      TableStatus currentStatus = response.table().tableStatus();\n      if (!currentStatus.equals(TableStatus.ACTIVE)) {\n        throw new IllegalStateException(\n            String.format(\n                \"Dynamo table %s is not active, current status: %s\", tableName, currentStatus));\n      }\n    } catch (ResourceNotFoundException e) {\n      throw new IllegalStateException(String.format(\"Cannot find Dynamo table %s\", tableName));\n    }\n  }\n\n  @Override\n  public void initialize(Map<String, String> properties) {\n    super.initialize(properties);\n    this.dynamo = AwsClientFactories.from(properties).dynamo();\n    this.lockTableName = properties.get(CatalogProperties.LOCK_TABLE);\n    Preconditions.checkNotNull(lockTableName, \"DynamoDB lock table name must not be null\");\n    ensureLockTableExistsOrCreate();\n  }\n\n  @Override\n  public boolean acquire(String entityId, String ownerId) {\n    try {\n      Tasks.foreach(entityId)\n          .throwFailureWhenFinished()\n          .retry(Integer.MAX_VALUE - 1)","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbLockManager.java#L143-L179","documentation":"IllegalStateException from DynamoDbLockManager.checkTableActive when DescribeTable raises ResourceNotFoundException, i.e. the configured lock table does not exist. Unlike other paths, the ResourceNotFound cause is discarded and rethrown as IllegalStateException.","triggerScenarios":"acquire/release on a lock table name that does not exist in the current region/account.","commonSituations":"Lock table never created; typo in the table-name property; wrong AWS region configured so the table lookup hits the wrong partition; table deleted by lifecycle policy or another team.","solutions":["Create the Dynamo lock table with the key schema DynamoDbLockManager expects (entityId hash key)","Verify the table name property and the client region match where the table exists","Check the AWS console/CloudTrail to see whether the table was deleted recently"],"exampleFix":"// before\nLockManager lockManager = new DynamoDbLockManager(dynamo, \"iceberg-locks\");\n// after\n// create the table first (hash key: entityId)\ndynamo.createTable(b -> b.tableName(\"iceberg-locks\")\n    .keySchema(k -> k.hashKey(\"entityId\"))\n    .attributeDefinitions(a -> a.attributeName(\"entityId\").attributeType(\"S\"))\n    .billingMode(BillingMode.PAY_PER_REQUEST));\nLockManager lockManager = new DynamoDbLockManager(dynamo, \"iceberg-locks\");","handlingStrategy":"validation","validationCode":"boolean exists = dynamo.listTables().tableNames().contains(lockTableName);\nif (!exists) {\n  dynamo.createTable(b -> b.tableName(lockTableName)\n      .keySchema(k -> k.hashKey(\"entityId\"))\n      .attributeDefinitions(a -> a.attributeName(\"entityId\").attributeType(\"S\"))\n      .billingMode(BillingMode.PAY_PER_REQUEST));\n}","typeGuard":null,"tryCatchPattern":"try {\n  lockManager.acquire(entityId, ownerId);\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"Cannot find Dynamo table\")) {\n    createLockTable(lockTableName); // provision then retry\n  }\n  throw e;\n}","preventionTips":["Provision the lock table via IaC (Terraform/CloudFormation) before deployment","Verify table name and region in properties match the deployed resource","Enable deletion protection on the lock table"],"tags":["aws","dynamodb","locking","table-not-found"],"backgroundTag":"resource-not-found","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"}