{"record":{"id":"2ab714e135d6218d","repo":"apache/beam","slug":"entry-doesn-t-have-a-schema-please-attach-a-schema-to","errorCode":null,"errorMessage":"Entry doesn't have a schema. Please attach a schema to '{tableName}' in Data Catalog: {entry}","messagePattern":"Entry doesn't have a schema\\. Please attach a schema to '(.+?)' in Data Catalog: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogTableProvider.java","lineNumber":191,"sourceCode":"                  .build());\n      builder\n          .updateEntrySettings()\n          .setRetryableCodes(\n              ImmutableSet.of(Code.PERMISSION_DENIED, Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE))\n          .setRetrySettings(\n              builder.updateEntrySettings().getRetrySettings().toBuilder()\n                  .setMaxRetryDelay(Duration.ofMinutes(1L))\n                  .build());\n\n      return DataCatalogClient.create(builder.build());\n    } catch (IOException e) {\n      throw new RuntimeException(\"Error creating Data Catalog client\", e);\n    }\n  }\n\n  private Table toCalciteTable(String tableName, Entry entry) {\n    if (entry.getSchema().getColumnsCount() == 0) {\n      throw new UnsupportedOperationException(\n          \"Entry doesn't have a schema. Please attach a schema to '\"\n              + tableName\n              + \"' in Data Catalog: \"\n              + entry.toString());\n    }\n    Schema schema = SchemaUtils.fromDataCatalog(entry.getSchema());\n\n    Optional<Table.Builder> tableBuilder = tableFactory.tableBuilder(entry);\n    if (!tableBuilder.isPresent()) {\n      throw new UnsupportedOperationException(\n          String.format(\n              \"Unsupported Data Catalog entry: %s\",\n              MoreObjects.toStringHelper(entry)\n                  .add(\"linkedResource\", entry.getLinkedResource())\n                  .add(\"hasGcsFilesetSpec\", entry.hasGcsFilesetSpec())\n                  .toString()));\n    }\n","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogTableProvider.java#L173-L209","documentation":"After a successful DataCatalog lookup, toCalciteTable requires the entry to carry a column schema; entries with zero schema columns are rejected with UnsupportedOperationException telling the user to attach a schema to the entry in Data Catalog. Beam SQL cannot build a BeamSqlTable without column definitions.","triggerScenarios":"Looking up a DataCatalog entry that was registered without a schema (tag template only, schema never attached, or schema attached to a different entry/tag).","commonSituations":"Entries created programmatically without setting the CloudSchema, BigQuery tables whose schema was never synced into the catalog entry, or looking up the wrong entry version that predates schema attachment.","solutions":["Attach a schema to the DataCatalog entry (console: entry > Attach schema, or DataCatalogClient.updateEntry/CloudSchema).","For BigQuery-backed entries, verify the BigQuery table has a defined schema and re-sync it into DataCatalog.","Confirm you are resolving the intended entry, not an empty one created by an earlier failed registration."],"exampleFix":"// before\n// DataCatalog entry 'my-proj:my_ds.t' created with no schema -> throws\n\n// after\n// attach schema before querying:\n// dataCatalogClient.updateEntry(entryName, entry.toBuilder().setSchema(cloudSchema).build());","handlingStrategy":"validation","validationCode":"Entry entry = dataCatalogClient.lookupEntry(\n    LookupEntryRequest.newBuilder().setSqlResource(tableName).build());\nif (entry.getSchema().getColumnsCount() == 0) {\n  throw new IllegalStateException(\"Entry has no schema: \" + tableName);\n}","typeGuard":null,"tryCatchPattern":"try {\n  Table t = provider.getTable(tableName);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"doesn't have a schema\")) {\n    // attach schema to the entry, then retry\n  }\n}","preventionTips":["Attach a schema when creating DataCatalog entries, before running SQL","For BigQuery entries, ensure the table schema is synced into the catalog","Verify the resolved entry is the one that carries the schema (not an empty duplicate)"],"tags":["apache-beam","datacatalog","java","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}