prestodb/presto · error · java.lang.IllegalArgumentException
QualifiedObjectName should have exactly 3 parts, found %s: %
Error message
QualifiedObjectName should have exactly 3 parts, found %s: %s
What it means
QualifiedObjectName.valueOf(String) parses a fully qualified object name of the form catalog.schema.table. It throws this IllegalArgumentException when splitting the string on '.' does not yield exactly 3 parts, since a qualified object name must have all three components.
Source
Thrown at presto-common/src/main/java/com/facebook/presto/common/QualifiedObjectName.java:45
import static java.util.Locale.ENGLISH;
import static java.util.Objects.requireNonNull;
@Immutable
@ThriftStruct
public class QualifiedObjectName
{
private final String catalogName;
private final String schemaName;
private final String objectName;
@JsonCreator
public static QualifiedObjectName valueOf(String name)
{
requireNonNull(name, "name is null");
String[] parts = name.split("\\.");
if (parts.length != 3) {
throw new IllegalArgumentException(format("QualifiedObjectName should have exactly 3 parts, found %s: %s", parts.length, name));
}
return new QualifiedObjectName(parts[0], parts[1], parts[2]);
}
public static QualifiedObjectName valueOf(CatalogSchemaName catalogSchemaName, String objectName)
{
return new QualifiedObjectName(catalogSchemaName.getCatalogName(), catalogSchemaName.getSchemaName(), objectName.toLowerCase(ENGLISH));
}
public static QualifiedObjectName valueOf(String catalogName, String schemaName, String objectName)
{
return new QualifiedObjectName(catalogName, schemaName, objectName.toLowerCase(ENGLISH));
}
@JsonCreator
@ThriftConstructor
public QualifiedObjectName(View on GitHub (pinned to 55bb57d202)
Solutions
- Supply the name in catalog.schema.table form, e.g. "hive.default.my_table".
- If parts come from separate variables, use QualifiedObjectName.valueOf(CatalogSchemaName, objectName) or the constructor instead of joining strings.
- Escape or strip unwanted dots, or parse user input yourself and reject invalid formats with a friendly message before calling valueOf().
- Handle quoted identifiers by removing quotes before parsing, since split("\.") does not honor SQL quoting.
Example fix
// before
QualifiedObjectName name = QualifiedObjectName.valueOf("hive.default"); // throws
// after
String tableName = requireNonNull(tableNameFromConfig);
QualifiedObjectName name = QualifiedObjectName.valueOf("hive.default." + tableName); Defensive patterns
Strategy: validation
Validate before calling
String[] parts = name.split("\\.");
if (parts.length != 3) {
throw new IllegalArgumentException("expected catalog.schema.table, got: " + name);
}
QualifiedObjectName obj = QualifiedObjectName.valueOf(name); Type guard
boolean isQualifiedObjectName(String name) {
return name != null && name.split("\\.", -1).length == 3;
} Try / catch
try {
QualifiedObjectName name = QualifiedObjectName.valueOf(raw);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("table name must be catalog.schema.table format", e);
} Prevention
- Always pass fully qualified catalog.schema.table strings.
- Prefer the valueOf(CatalogSchemaName, String) overload when components are separate.
- Strip quotes and validate user-supplied table names before parsing.
- Handle quoted identifiers manually; split("\.") ignores SQL quoting.
When it happens
Trigger: Passing a name string with fewer or more than 2 dots to QualifiedObjectName.valueOf() — e.g. "mytable", "schema.table", "catalog.schema.table.column", or names containing extra dots.
Common situations: Configuration/SQL properties where users provide unqualified or partially qualified table names; quoted identifiers or dots inside identifier parts that break the naive split; programmatic string concatenation producing a 4-part path.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Bad type signature: '%s'
- Could not parse selected role:
- INVALID_FUNCTION_ARGUMENT
- Invalid day-time interval:
- Invalid year-month interval:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/fa74899867eef422.
Report an issue: GitHub.