{"record":{"id":"cb77da503d4cbe6e","repo":"lancedb/lancedb","slug":"table-identifier-cannot-be-null-or-empty","errorCode":null,"errorMessage":"Table identifier cannot be null or empty","messagePattern":"Table identifier cannot be null or empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/lancedb-core/src/main/java/com/lancedb/LanceDbTableLsm.java","lineNumber":87,"sourceCode":"  private static final long RETRY_BACKOFF_BASE_MS = 100L;\n  private static final long RETRY_BACKOFF_MAX_MS = 5_000L;\n\n  private final LanceDbRestClient client;\n  private final String tableIdentifier;\n\n  /**\n   * Bind the LSM routes for one table.\n   *\n   * @param client Transport for the LanceDB endpoint.\n   * @param tableIdentifier The table's full identifier, {@code $}-delimited when it sits inside a\n   *     namespace, such as {@code analytics$events}.\n   */\n  public LanceDbTableLsm(LanceDbRestClient client, String tableIdentifier) {\n    if (client == null) {\n      throw new IllegalArgumentException(\"Client cannot be null\");\n    }\n    if (tableIdentifier == null || tableIdentifier.trim().isEmpty()) {\n      throw new IllegalArgumentException(\"Table identifier cannot be null or empty\");\n    }\n    this.client = client;\n    this.tableIdentifier = tableIdentifier;\n  }\n\n  /**\n   * Install an {@link LsmWriteSpec} on this table, selecting the MemWAL LSM write path for future\n   * {@code mergeInsert} calls.\n   *\n   * <p>All variants require the table to have an unenforced primary key; bucket sharding\n   * additionally requires it to be the single column being bucketed.\n   */\n  public void setLsmWriteSpec(LsmWriteSpec spec) {\n    if (spec == null) {\n      throw new IllegalArgumentException(\"Spec cannot be null\");\n    }\n    client.post(route(\"set_lsm_write_spec\"), spec.toRequestBody());\n  }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/lancedb/lancedb/blob/c7b051aff7039333a3f61b79217246c27676806a/java/lancedb-core/src/main/java/com/lancedb/LanceDbTableLsm.java#L69-L105","documentation":"The LanceDbTableLsm constructor throws IllegalArgumentException when tableIdentifier is null, empty, or whitespace-only. The identifier (e.g. 'events' or namespace-qualified 'analytics$events') is used to build every REST route, so a blank value is rejected up front.","triggerScenarios":"Calling new LanceDbTableLsm(client, null), new LanceDbTableLsm(client, \"\"), or passing a name derived from splitting a qualified identifier where the expected segment is missing.","commonSituations":"Extracting the table name from config or a URI where the key is absent, wrong delimiter when parsing namespace-qualified names, or passing user input without trimming/validating.","solutions":["Pass the correct non-blank table identifier, e.g. new LanceDbTableLsm(client, \"analytics$events\").","If parsing the identifier, verify the split produced the expected segment before constructing.","Trim and validate user/config-supplied table names before constructing the helper.","Catch IllegalArgumentException around construction to report the bad identifier clearly."],"exampleFix":"// before\nString id = parts.length > 1 ? parts[1] : null;\nLanceDbTableLsm lsm = new LanceDbTableLsm(client, id); // IAE when parts.length <= 1\n// after\nif (parts.length < 2 || parts[1].isBlank()) {\n  throw new IllegalArgumentException(\"Qualified table name missing table segment\");\n}\nLanceDbTableLsm lsm = new LanceDbTableLsm(client, parts[1]);","handlingStrategy":"validation","validationCode":"if (tableId == null || tableId.trim().isEmpty()) {\n  throw new IllegalArgumentException(\"tableId must be a non-blank identifier, e.g. analytics$events\");\n}\nLanceDbTableLsm lsm = new LanceDbTableLsm(client, tableId.trim());","typeGuard":null,"tryCatchPattern":"try {\n  lsm = new LanceDbTableLsm(client, tableId);\n} catch (IllegalArgumentException e) {\n  throw new IllegalArgumentException(\"Bad table identifier: \" + e.getMessage(), e);\n}","preventionTips":["Validate parsed/derived identifiers before constructing helpers.","Check split/substring results when parsing namespace-qualified names.","Trim user- or config-supplied table names before use."],"tags":["java","null-argument","empty-string","constructor-validation"],"backgroundTag":"empty-required-field","analyzedSha":"c7b051aff7039333a3f61b79217246c27676806a","analyzedAt":"2026-09-08T23:42:37.579Z","contentChangedAt":"2026-09-08T23:42:37.579Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}