{"record":{"id":"0cbf8c624ee5e5bd","repo":"apache/beam","slug":"invalid-table-id-s-table-ids-must-be-alphanumeric-plus","errorCode":null,"errorMessage":"invalid table ID %s. Table IDs must be alphanumeric (plus underscores) and must be at most 1024 characters long. Also, table decorators cannot be used.","messagePattern":"invalid table ID (.+?)\\. Table IDs must be alphanumeric \\(plus underscores\\) and must be at most 1024 characters long\\. Also, table decorators cannot be used\\.","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/FakeDatasetService.java","lineNumber":370,"sourceCode":"          tables.get(tableRef.getProjectId(), tableRef.getDatasetId());\n      if (dataset == null) {\n        throwNotFound(\n            \"Tried to get a dataset %s:%s, but no such table was set\",\n            tableRef.getProjectId(), tableRef.getDatasetId());\n      }\n      dataset.remove(tableRef.getTableId());\n    }\n  }\n\n  /**\n   * Validates a table reference for whole-table operations, such as create/delete/patch. Such\n   * operations do not support partition decorators.\n   */\n  private static void validateWholeTableReference(TableReference tableReference)\n      throws IOException {\n    final Pattern tableRegexp = Pattern.compile(\"[-\\\\w]{1,1024}\");\n    if (!tableRegexp.matcher(tableReference.getTableId()).matches()) {\n      throw new IOException(\n          String.format(\n              \"invalid table ID %s. Table IDs must be alphanumeric \"\n                  + \"(plus underscores) and must be at most 1024 characters long. Also, table\"\n                  + \" decorators cannot be used.\",\n              tableReference.getTableId()));\n    }\n  }\n\n  @Override\n  public void createTable(Table table) throws IOException {\n    TableReference tableReference = table.getTableReference();\n    validateWholeTableReference(tableReference);\n    synchronized (FakeDatasetService.class) {\n      Map<String, TableContainer> dataset =\n          tables.get(tableReference.getProjectId(), tableReference.getDatasetId());\n      if (dataset == null) {\n        throwNotFound(\n            \"Tried to get a dataset %s:%s, but no such table was set\",","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/FakeDatasetService.java#L352-L388","documentation":"validateWholeTableReference throws IOException when the table id does not match [-\\w]{1,1024}, i.e. it contains characters other than letters, digits, underscores and hyphens, exceeds 1024 characters, or uses table decorators like 'table$20240101'. FakeDatasetService enforces BigQuery's table-id rules for mutation operations.","triggerScenarios":"deleteTable, createTable, updateTableSchema, setPrimaryKey, or patchTableDescription called with a table id containing dots, slashes, spaces, decorator suffixes ('table@time'), or longer than 1024 chars.","commonSituations":"Passing 'project:dataset.table' as the table id instead of just the table id; appending partition/decorator syntax; interpolating an empty or URL-encoded id from config.","solutions":["Pass only the bare table id to setTableId (no project/dataset prefix, no decorators)","Strip decorators/partition suffixes before validating (split on '$', '@', '/')","Check length <= 1024 and characters [-\\w] in your own code before invoking the fake"],"exampleFix":"// before\nref.setTableId(\"mytable$20240101\");\nservice.createTable(ref, schema); // IOException\n// after\nref.setTableId(\"mytable\");\nservice.createTable(ref, schema);","handlingStrategy":"validation","validationCode":"private static final Pattern TABLE_ID = Pattern.compile(\"[-\\\\w]{1,1024}\");\nif (!TABLE_ID.matcher(tableRef.getTableId()).matches()) {\n  throw new IllegalArgumentException(\"invalid tableId: \" + tableRef.getTableId());\n}","typeGuard":"boolean isValidTableId(String id) {\n  return id != null && id.matches(\"[-\\\\w]{1,1024}\");\n}","tryCatchPattern":"try {\n  service.createTable(ref, schema);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"invalid table ID\")) {\n    throw new IllegalArgumentException(e.getMessage(), e);\n  }\n  throw e;\n}","preventionTips":["Never embed project/dataset into setTableId","Strip '$', '@' and path separators from ids derived from URLs or config","Log/validate table ids at startup"],"tags":["bigquery","validation","table-id","java"],"backgroundTag":"invalid-identifier-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}