prestodb/presto · error · PrestoException
NOT_FOUND
NOT_FOUND
Error message
Table %s.%s does not have columns %s
What it means
validateSchema compares the column names/types recorded in the file's schema (hive.columns/columns.types properties) with the table's current metastore columns; this fires when writing to an existing table/partition whose stored schema lacks columns the writer expects.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveWriterFactory.java:576
return new WriterParameters(
UpdateMode.NEW,
getHiveSchema(table),
writerInfo,
fromHiveStorageFormat(storageFormat));
}
private void validateSchema(Optional<String> partitionName, Properties schema)
{
// existing tables may have columns in a different order
List<String> fileColumnNames = Splitter.on(',').trimResults().omitEmptyStrings().splitToList(schema.getProperty(META_TABLE_COLUMNS, ""));
List<HiveType> fileColumnHiveTypes = toHiveTypes(schema.getProperty(META_TABLE_COLUMN_TYPES, ""));
// verify we can write all input columns to the file
Map<String, DataColumn> inputColumnMap = dataColumns.stream()
.collect(toMap(DataColumn::getName, identity()));
Set<String> missingColumns = Sets.difference(inputColumnMap.keySet(), new HashSet<>(fileColumnNames));
if (!missingColumns.isEmpty()) {
throw new PrestoException(NOT_FOUND, format("Table %s.%s does not have columns %s", schema, tableName, missingColumns));
}
if (fileColumnNames.size() != fileColumnHiveTypes.size()) {
throw new PrestoException(HIVE_INVALID_METADATA, format(
"Partition '%s' in table '%s.%s' has mismatched metadata for column names and types",
partitionName,
schemaName,
tableName));
}
// verify the file types match the input type
// todo adapt input types to the file types as Hive does
for (int fileIndex = 0; fileIndex < fileColumnNames.size(); fileIndex++) {
String columnName = fileColumnNames.get(fileIndex);
HiveType fileColumnHiveType = fileColumnHiveTypes.get(fileIndex);
HiveType inputHiveType = inputColumnMap.get(columnName).getHiveType();
if (!fileColumnHiveType.equals(inputHiveType)) {
// todo this should be moved to a helperView on GitHub (pinned to 55bb57d202)
Solutions
- Add the missing columns to the table (ALTER TABLE ADD COLUMN)
- Align the insert's column list with the actual table columns
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveWriterFactory.java:576 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/85e9982b16c850e7.
Report an issue: GitHub.