{"record":{"id":"73f72ae4acd43450","repo":"apache/iceberg","slug":"cannot-parse-description-name-73f72a","errorCode":null,"errorMessage":"Cannot parse <description>: <name>","messagePattern":"Cannot parse <description>: <name>","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java","lineNumber":810,"sourceCode":"      SparkSession spark, String name, CatalogPlugin defaultCatalog) throws ParseException {\n    ParserInterface parser = spark.sessionState().sqlParser();\n    Seq<String> multiPartIdentifier = parser.parseMultipartIdentifier(name).toIndexedSeq();\n    List<String> javaMultiPartIdentifier = JavaConverters.seqAsJavaList(multiPartIdentifier);\n    return catalogAndIdentifier(spark, javaMultiPartIdentifier, defaultCatalog);\n  }\n\n  public static CatalogAndIdentifier catalogAndIdentifier(\n      String description, SparkSession spark, String name) {\n    return catalogAndIdentifier(\n        description, spark, name, spark.sessionState().catalogManager().currentCatalog());\n  }\n\n  public static CatalogAndIdentifier catalogAndIdentifier(\n      String description, SparkSession spark, String name, CatalogPlugin defaultCatalog) {\n    try {\n      return catalogAndIdentifier(spark, name, defaultCatalog);\n    } catch (ParseException e) {\n      throw new IllegalArgumentException(\"Cannot parse \" + description + \": \" + name, e);\n    }\n  }\n\n  public static CatalogAndIdentifier catalogAndIdentifier(\n      SparkSession spark, List<String> nameParts) {\n    return catalogAndIdentifier(\n        spark, nameParts, spark.sessionState().catalogManager().currentCatalog());\n  }\n\n  /**\n   * A modified version of Spark's LookupCatalog.CatalogAndIdentifier.unapply Attempts to find the\n   * catalog and identifier a multipart identifier represents\n   *\n   * @param spark Spark session to use for resolution\n   * @param nameParts Multipart identifier representing a table\n   * @param defaultCatalog Catalog to use if none is specified\n   * @return The CatalogPlugin and Identifier for the table\n   */","sourceCodeStart":792,"sourceCodeEnd":828,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java#L792-L828","documentation":"catalogAndIdentifier parses a table/namespace name string into Spark's Identifier using a SQL parser. If the name is not a valid multipart identifier, the underlying ParseException is rethrown as this IllegalArgumentException, prefixed with the caller-provided description (e.g. 'namespace' or 'table').","triggerScenarios":"Calling Spark3Util.catalogAndIdentifier(description, spark, name, defaultCatalog) with a name that fails Spark's parser, e.g. unescaped special characters like my.table, backticks in odd places, or empty parts.","commonSituations":"Users passing fully-qualified names with unescaped dots or backticks in SQL commands like ALTER TABLE or CREATE TABLE routed through custom catalogs; confusion between catalog.table vs table naming conventions.","solutions":["Quote problematic identifier parts with backticks: `my.table` instead of my.table.","Verify the name has the expected number of parts for catalog.namespace.table resolution.","Escape backticks inside identifiers by doubling them (`a``b`).","Catch IllegalArgumentException from catalogAndIdentifier and show the user a clearer naming-convention message."],"exampleFix":"// before\nString name = \"catalog:my.table\";\ncatalogAndIdentifier(\"table\", spark, name, defaultCatalog); // ParseException\n// after\nString name = \"catalog.`my.table`\";\ncatalogAndIdentifier(\"table\", spark, name, defaultCatalog); // ok","handlingStrategy":"validation","validationCode":"// Scala/Java pseudo-check before calling\nboolean looksParseable = name != null && !name.trim().isEmpty() &&\n    Arrays.stream(name.split(\"\\\\.\"))\n          .allMatch(p -> p.isEmpty() || (p.startsWith(\"`\") == p.endsWith(\"`\")));","typeGuard":null,"tryCatchPattern":"try {\n  CatalogAndIdentifier id = Spark3Util.catalogAndIdentifier(\"table\", spark, name, defaultCatalog);\n} catch (IllegalArgumentException e) {\n  throw new UserFacingError(\"Invalid table name '\" + name + \"'. Quote special parts with backticks.\", e);\n}","preventionTips":["Always backtick-quote identifier parts containing dots, spaces, or special characters","Validate name-part count matches catalog.namespace.table expectations before parsing","Escape embedded backticks by doubling them","Log the raw user input alongside the parsed parts to debug resolution issues"],"tags":["spark","identifier-parsing","invalid-name"],"backgroundTag":"invalid-identifier-format","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}