{"record":{"id":"ca82934ff13b027e","repo":"prestodb/presto","slug":"schematablename-should-have-exactly-2-parts","errorCode":null,"errorMessage":"SchemaTableName should have exactly 2 parts","messagePattern":"SchemaTableName should have exactly 2 parts","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/SchemaTableName.java","lineNumber":46,"sourceCode":"{\n    private final String schemaName;\n    private final String tableName;\n\n    @JsonCreator\n    @ThriftConstructor\n    public SchemaTableName(@JsonProperty(\"schema\") String schemaName, @JsonProperty(\"table\") String tableName)\n    {\n        this.schemaName = checkNotEmpty(schemaName, \"schemaName\");\n        this.tableName = checkNotEmpty(tableName, \"tableName\");\n    }\n\n    public static SchemaTableName valueOf(String schemaTableName)\n    {\n        checkNotEmpty(schemaTableName, \"schemaTableName\");\n\n        String[] parts = schemaTableName.split(\"\\\\.\");\n        if (parts.length != 2) {\n            throw new IllegalArgumentException(\"SchemaTableName should have exactly 2 parts\");\n        }\n        return new SchemaTableName(parts[0], parts[1]);\n    }\n\n    @JsonProperty(\"schema\")\n    @ThriftField(value = 1, name = \"schema\")\n    public String getSchemaName()\n    {\n        return schemaName;\n    }\n\n    @JsonProperty(\"table\")\n    @ThriftField(value = 2, name = \"table\")\n    public String getTableName()\n    {\n        return tableName;\n    }\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/SchemaTableName.java#L28-L64","documentation":"SchemaTableName.valueOf parses a string into a SchemaTableName and requires exactly one dot separating schema and table. IllegalArgumentException(\"SchemaTableName should have exactly 2 parts\") is thrown when the string splits into fewer or more than 2 dot-separated parts.","triggerScenarios":"Calling SchemaTableName.valueOf with a string that has no dot (e.g. \"mytable\"), more than one dot (e.g. \"catalog.schema.table\"), or a trailing/leading dot (e.g. \"schema.\") .","commonSituations":"Passing a fully qualified catalog.schema.table identifier instead of schema.table; concatenating table name parts with an extra separator; empty components from config properties or CLI args; catalog name accidentally included in a connector config that expects schema.table.","solutions":["Pass exactly \"<schema>.<table>\" to valueOf; strip the catalog prefix if present","Split the identifier yourself and construct with new SchemaTableName(schema, table) to control parsing (handles quoted names)","Trim or unquote the string first; validate it contains exactly one unescaped dot before calling valueOf"],"exampleFix":"// before\nSchemaTableName name = SchemaTableName.valueOf(\"mycatalog.myschema.mytable\");\n// after\nSchemaTableName name = new SchemaTableName(\"myschema\", \"mytable\");","handlingStrategy":"validation","validationCode":"if (s.chars().filter(c -> c == '.').count() != 1) throw new IllegalArgumentException(\"expected schema.table: \" + s);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep identifiers split into components until the last moment; construct with new SchemaTableName(schema, table)","Strip catalog prefixes before parsing schema.table strings","Add unit tests for valueOf with 0, 1, and 3-part strings"],"tags":["spi","illegal-argument","identifier-parsing"],"backgroundTag":"schema-identifier-parse-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}