{"record":{"id":"fea5d650b9f407c7","repo":"apache/druid","slug":"table-s-not-found","errorCode":null,"errorMessage":"Table %s: not found","messagePattern":"Table (.+?): not found","errorType":"exception","errorClass":"ISE","httpStatus":null,"severity":"error","filePath":"extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/storage/sql/SQLCatalogManager.java","lineNumber":401,"sourceCode":"                } else {\n                  throw tableNotFound(id);\n                }\n                final TableSpec revised = transform.apply(TableMetadata.of(id, tableSpec));\n                if (revised == null) {\n                  handle.rollback();\n                  return null;\n                }\n                final long updateTime = System.currentTimeMillis();\n                final int updateCount = handle\n                    .createStatement(statement(UPDATE_PROPERTIES_STMT))\n                    .bind(SCHEMA_NAME_COL, id.schema())\n                    .bind(TABLE_NAME_COL, id.name())\n                    .bind(PROPERTIES_COL, JacksonUtils.toBytes(jsonMapper, revised.properties()))\n                    .bind(UPDATE_TIME_COL, updateTime)\n                    .execute();\n                if (updateCount == 0) {\n                  // Should never occur because we're holding a lock.\n                  throw new ISE(\"Table %s: not found\", id.sqlName());\n                }\n                handle.commit();\n                return TableMetadata.forUpdate(id, updateTime, revised);\n              }\n              catch (Exception e) {\n                handle.rollback();\n                throw e;\n              }\n            }\n          }\n      );\n      if (result == null) {\n        return 0;\n      }\n      sendUpdate(EventType.PROPERTY_UPDATE, result);\n      return result.updateTime();\n    }\n    catch (CallbackFailedException e) {","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/storage/sql/SQLCatalogManager.java#L383-L419","documentation":"Inside alterTableProperties, after acquiring the table lock, the UPDATE of the properties column returned 0 affected rows. Since the lock should guarantee existence, this is flagged as an internal invariant violation (ISE) rather than an expected error — the row vanished unexpectedly or the id didn't match.","triggerScenarios":"alterTableProperties(id, ...) under lock where the UPDATE ... WHERE name matches zero rows: the table was concurrently deleted despite the lock, or the TableId name mismatches the stored name.","commonSituations":"Concurrent dropTable racing the locked alter (lock gap); DB row manually deleted; passing an id with different case/normalization than what createTable stored.","solutions":["Check for concurrent deleteTable calls and ensure the table lock covers the entire alter/delete lifecycle.","Confirm the TableId matches exactly the name used at creation (case/whitespace).","Inspect the catalog table in the DB to see whether the row exists and under what name.","If caused by tooling modifying the DB out-of-band, restrict direct DB edits and re-create the table."],"exampleFix":"// before\nmanager.alterTableProperties(id, revised); // ISE: Table X: not found\n\n// after\nif (manager.readTable(id) != null) {\n  manager.alterTableProperties(id, revised);\n}","handlingStrategy":"validation","validationCode":"if (manager.readTable(id) == null) {\n  throw new IllegalStateException(\"Table not found before alterTableProperties: \" + id.sqlName());\n}","typeGuard":null,"tryCatchPattern":"try {\n  manager.alterTableProperties(id, revised);\n} catch (ISE e) {\n  if (e.getMessage().contains(\"not found\")) {\n    // reconcile: re-read table, check for concurrent delete\n  }\n}","preventionTips":["Verify the exact TableId used at creation (case, whitespace).","Serialize deletes and property alters under the same lock.","Avoid direct manual edits to the catalog metadata DB."],"tags":["sql","concurrency","internal-error"],"backgroundTag":"internal-invariant-violation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}