{"record":{"id":"9f1e3913b1829b57","repo":"apache/iceberg","slug":"dynamo-table-s-is-not-active-current-status-s","errorCode":null,"errorMessage":"Dynamo table %s is not active, current status: %s","messagePattern":"Dynamo table (.+?) is not active, current status: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbLockManager.java","lineNumber":156,"sourceCode":"  }\n\n  @VisibleForTesting\n  boolean tableExists(String tableName) {\n    try {\n      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","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aws/src/main/java/org/apache/iceberg/aws/dynamodb/DynamoDbLockManager.java#L138-L174","documentation":"IllegalStateException from DynamoDbLockManager.checkTableActive when the Dynamo table used for locking exists but its status is not ACTIVE (e.g. CREATING, UPDATING, DELETING). The lock manager requires a fully active table to perform consistent reads and conditional writes.","triggerScenarios":"acquire or release calling checkTableActive while the lock table is mid-creation, being updated (throughput change), or being deleted.","commonSituations":"Client started immediately after table creation before the table finished provisioning; autoscaling update in progress; table being torn down while a worker still runs.","solutions":["Wait until describeTable reports status ACTIVE before initializing the lock manager","If the table was just created, retry after provisioning completes (or use a waiter)","Check CloudTrail/console for an in-progress UpdateTable or DeleteTable and wait for it to finish","If the table was deleted unintentionally, recreate it with the expected key schema"],"exampleFix":"// before\nDynamoDbLockManager lockManager = new DynamoDbLockManager(dynamo, tableName);\n// after\nTableWaiter waiter = dynamo.waiter();\nwaiter.waitUntilTableExists(b -> b.tableName(tableName));\nDynamoDbLockManager lockManager = new DynamoDbLockManager(dynamo, tableName);","handlingStrategy":"retry","validationCode":"TableStatus status = dynamo.describeTable(b -> b.tableName(lockTable)).table().tableStatus();\nif (status != TableStatus.ACTIVE) {\n  throw new IllegalStateException(\"Lock table not ready: \" + status);\n}","typeGuard":null,"tryCatchPattern":"try {\n  lockManager.acquire(entityId, ownerId);\n} catch (IllegalStateException e) {\n  // wait for table to become ACTIVE, then retry with backoff\n  Thread.sleep(10_000);\n  lockManager.acquire(entityId, ownerId);\n}","preventionTips":["Use a DynamoDB waiter (waitUntilTableExists) before initializing the lock manager","Avoid teardown of lock tables while workers run","Gate provisioning infrastructure before starting jobs that lock"],"tags":["aws","dynamodb","locking","table-status"],"backgroundTag":"invalid-state-transition","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"}