{"record":{"id":"dd7230c734f1954b","repo":"apache/beam","slug":"bigtable-location-must-be-in-the-following-format-googleapis","errorCode":null,"errorMessage":"Bigtable location must be in the following format: 'googleapis.com/bigtable/projects/projectId/instances/instanceId/tables/tableId' but was: %s","messagePattern":"Bigtable location must be in the following format: 'googleapis\\.com/bigtable/projects/projectId/instances/instanceId/tables/tableId' but was: (.+?)","errorType":"validation","errorClass":"InvalidTableException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigtable/BigtableTable.java","lineNumber":170,"sourceCode":"    String value = matcher.group(field);\n    return value == null ? \"\" : value;\n  }\n\n  private static void validateSchema(Schema schema) {\n    if (!schema.hasField(KEY)) {\n      throw new IllegalStateException(String.format(\"Schema has to contain '%s' field\", KEY));\n    } else {\n      Schema.Field keyField = schema.getField(KEY);\n      if (keyField != null && !(Schema.TypeName.STRING == keyField.getType().getTypeName())) {\n        throw new IllegalArgumentException(\n            \"key field type should be STRING but was \" + keyField.getType().getTypeName());\n      }\n    }\n  }\n\n  private static void validateMatcher(Matcher matcher, String location) {\n    if (!matcher.matches()) {\n      throw new InvalidTableException(\n          \"Bigtable location must be in the following format:\"\n              + \" 'googleapis.com/bigtable/projects/projectId/instances/instanceId/tables/tableId'\"\n              + \" but was: \"\n              + location);\n    }\n  }\n\n  private static void validateColumnsMapping(\n      Map<String, Set<String>> columnsMapping, Schema schema) {\n    validateColumnsMappingCount(columnsMapping, schema);\n    validateColumnsMappingFields(columnsMapping, schema);\n  }\n\n  private static void validateColumnsMappingCount(\n      Map<String, Set<String>> columnsMapping, Schema schema) {\n    int mappingCount = columnsMapping.values().stream().mapToInt(Set::size).sum();\n    // Don't count the key field\n    int qualifiersCount = schema.getFieldCount() - 1;","sourceCodeStart":152,"sourceCodeEnd":188,"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#L152-L188","documentation":"The LOCATION string of a Bigtable SQL table must match a strict pattern: it must contain googleapis.com/bigtable/projects/<projectId>/instances/<instanceId>/tables/<tableId>. validateMatcher throws InvalidTableException when the location string does not fully match this pattern, since the projectId/instanceId/tableId cannot be extracted.","triggerScenarios":"Supplying a LOCATION with wrong scheme (e.g. 'bigtable://mytable' or an https URL to the console), missing path segments (no /tables/<id>), or typos like 'project/' instead of 'projects/'.","commonSituations":"Pasting a Bigtable console URL instead of the resource path; omitting 'tables/tableId'; misspelling segments (instance vs instances); using a relative table name instead of the full resource URL.","solutions":["Use the exact format: LOCATION 'bigtable://googleapis.com/bigtable/projects/<projectId>/instances/<instanceId>/tables/<tableId>'.","Verify each path segment exists and is spelled 'projects/', 'instances/', 'tables/' with all three identifiers filled in.","Confirm project, instance and table IDs against `gcloud bigtable instances tables list --instance=<instanceId>`."],"exampleFix":"-- before\nLOCATION 'bigtable://my-instance/my-table'\n\n-- after\nLOCATION 'bigtable://googleapis.com/bigtable/projects/my-project/instances/my-instance/tables/my-table'","handlingStrategy":"validation","validationCode":"Pattern p = Pattern.compile(\"googleapis\\.com/bigtable/projects/(?<projectId>[^/]+)/instances/(?<instanceId>[^/]+)/tables/(?<tableId>[^/]+)$\");\nif (location == null || !p.matcher(location).matches()) {\n  throw new IllegalArgumentException(\"LOCATION must match bigtable://googleapis.com/bigtable/projects/{p}/instances/{i}/tables/{t}\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  BigtableTable t = new BigtableTable(table);\n} catch (InvalidTableException e) {\n  if (e.getMessage().contains(\"location must be in the following format\")) {\n    // correct the LOCATION string to the documented resource URL format\n  }\n}","preventionTips":["Copy the LOCATION format from working examples, not from the Bigtable console URL.","Keep all three identifiers (project, instance, table) in the path — none may be omitted.","Verify IDs with gcloud bigtable commands before embedding them in DDL."],"tags":["java","beam-sql","bigtable","url-format"],"backgroundTag":"invalid-url-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"}