{"record":{"id":"ac838fc62a1edc2c","repo":"apache/beam","slug":"location-is-required","errorCode":null,"errorMessage":"LOCATION is required","messagePattern":"LOCATION is required","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigtable/BigtableTable.java","lineNumber":74,"sourceCode":"      Pattern.compile(\n          \"(?<host>.+)/bigtable/projects/(?<projectId>.+)/instances/(?<instanceId>.+)/tables/(?<tableId>.+)\");\n\n  private final String projectId;\n  private final String instanceId;\n  private final String tableId;\n  private String emulatorHost = \"\";\n\n  private boolean useFlatSchema = false;\n\n  private Map<String, Set<String>> columnsMapping = newHashMap();\n\n  BigtableTable(Table table) {\n    super(table.getSchema());\n    validateSchema(schema);\n\n    String location = table.getLocation();\n    if (location == null) {\n      throw new IllegalStateException(\"LOCATION is required\");\n    }\n    Matcher matcher = locationPattern.matcher(location);\n    validateMatcher(matcher, location);\n\n    this.projectId = getMatcherValue(matcher, \"projectId\");\n    this.instanceId = getMatcherValue(matcher, \"instanceId\");\n    this.tableId = getMatcherValue(matcher, \"tableId\");\n    String host = getMatcherValue(matcher, \"host\"); // googleapis.com or localhost:<PORT>\n    if (!\"googleapis.com\".equals(host)) {\n      this.emulatorHost = host;\n    }\n\n    ObjectNode properties = table.getProperties();\n    if (properties.has(COLUMNS_MAPPING)) {\n      columnsMapping = parseColumnsMapping(properties.get(COLUMNS_MAPPING).asText());\n      validateColumnsMapping(columnsMapping, schema);\n      useFlatSchema = true;\n    }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigtable/BigtableTable.java#L56-L92","documentation":"BigtableTable wraps a Bigtable-backed SQL table in Beam SQL and requires the table's LOCATION property to parse out projectId, instanceId and tableId. When table.getLocation() returns null there is no location string to validate or parse, so the constructor fails fast with IllegalStateException. The location cannot be defaulted or inferred, so construction is aborted.","triggerScenarios":"Creating or loading a Bigtable SQL table (CREATE EXTERNAL TABLE ... LOCATION or provider catalog metadata) where the LOCATION clause/property is omitted entirely, so table.getLocation() is null when the BigtableTable constructor runs.","commonSituations":"Writing CREATE EXTERNAL TABLE DDL against provider 'bigtable' without a LOCATION; programmatic TableProvider catalog entries built with a Table that has no location set; migration from configs where LOCATION used to be optional.","solutions":["Add a LOCATION clause/property in the form 'bigtable://googleapis.com/bigtable/projects/<projectId>/instances/<instanceId>/tables/<tableId>' to the table definition.","If building the Table object in code, call Table.withLocation(...) with a valid bigtable URL before passing it to the provider.","Check catalog/metadata files for the table and add the missing location field, then reload the table provider."],"exampleFix":"-- before\nCREATE EXTERNAL TABLE bt_table (key STRING, cf_col STRING)\nTYPE 'bigtable'\nTBLPROPERTIES '{...}';\n\n-- after\nCREATE EXTERNAL TABLE bt_table (key STRING, cf_col STRING)\nTYPE 'bigtable'\nLOCATION 'bigtable://googleapis.com/bigtable/projects/my-project/instances/my-instance/tables/my-table'\nTBLPROPERTIES '{...}';","handlingStrategy":"validation","validationCode":"String location = table.getLocation();\nif (location == null || location.isEmpty()) {\n  throw new IllegalArgumentException(\"Bigtable table requires a LOCATION (bigtable://googleapis.com/bigtable/projects/...) before use\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  BigtableTable t = new BigtableTable(table);\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"LOCATION is required\")) {\n    // surface a config-fix message pointing at the LOCATION clause\n  }\n}","preventionTips":["Always include a LOCATION clause when declaring bigtable-provider tables.","Keep a checked-in DDL template for Bigtable tables with LOCATION pre-filled.","Validate table metadata (location non-null) at pipeline startup, before job submission."],"tags":["java","beam-sql","bigtable","configuration"],"backgroundTag":"missing-required-config-field","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"}