prestodb/presto · error · IllegalArgumentException

Unsupported update mode: %s

Error message

Unsupported update mode: %s

What it means

The partition update loop in finishInsert handles only the known update modes (NEW_TABLE/APPEND/OVERWRITE and the unpartitioned case). A PartitionUpdate carrying any other UpdateMode value falls into the final else and is rejected with an IllegalArgumentException, indicating an internal invariant violation rather than a user-facing condition.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:2378

                        columnTypes,
                        getColumnStatistics(session, partitionComputedStatistics, partitionName, partitionValues, partitionTypes),
                        timeZone);

                // New partition or overwriting existing partition by staging and moving the new partition
                if (!isExistingPartition || handle.getLocationHandle().getWriteMode() != DIRECT_TO_TARGET_EXISTING_DIRECTORY) {
                    metastore.addPartition(
                            session,
                            handle.getSchemaName(),
                            handle.getTableName(),
                            table.getStorage().getLocation(),
                            false,
                            partition,
                            partitionUpdate.getWritePath(),
                            partitionStatistics);
                }
            }
            else {
                throw new IllegalArgumentException(format("Unsupported update mode: %s", partitionUpdate.getUpdateMode()));
            }
        }

        return Optional.of(new HiveOutputMetadata(new HiveOutputInfo(
                partitionUpdates.stream()
                        .map(PartitionUpdate::getName)
                        .map(name -> name.isEmpty() ? UNPARTITIONED_ID.getPartitionName() : name)
                        .collect(toList()), table.getStorage().getLocation())));
    }

    /**
     * Deletes all the files not written by the current query from the given partition path.
     * This is required when we are overwriting the partitions by directly writing the new
     * files to the existing directory, where files written by older queries may be present too.
     *
     * @param session the ConnectorSession object
     * @param partitionPath the path of the partition from where the older files are to be deleted
     */

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify all coordinators and workers run the same Presto version and restart the cluster consistently
  2. Clear stale spooling directories and rerun the failed query
  3. Inspect the PartitionUpdate source (serialization/custom code) for an invalid updateMode and fix the producer; report the bug if it comes from stock Presto
Defensive patterns

Strategy: type-guard

Validate before calling

// Validate updateMode before finalizing metadata writes
Set<String> supported = Set.of("NEW_TABLE", "APPEND", "OVERWRITE");
if (!supported.contains(partitionUpdate.getUpdateMode().name())) {
    throw new IllegalStateException("Unsupported update mode: " + partitionUpdate.getUpdateMode());
}

Type guard

static boolean isSupportedUpdateMode(PartitionUpdate p) {
    return p != null && p.getUpdateMode() != null
        && (p.getUpdateMode() == UpdateMode.NEW_TABLE
         || p.getUpdateMode() == UpdateMode.APPEND
         || p.getUpdateMode() == UpdateMode.OVERWRITE);
}

Try / catch

try {
    commitPartitionUpdates(partitionUpdates);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unsupported update mode")) {
        // investigate version skew / spool files; do not blind-retry
    } else { throw e; }
}

Prevention

When it happens

Trigger: Internal bug or version-skew scenario: a PartitionUpdate produced by a writer/serialization path (e.g. PartitionUpdate JSON round-trip via a spooled file or an older coordinator/worker mix) whose updateMode is not one of the supported enum values handled in this code path.

Common situations: Coordinator and worker running different Presto versions sharing a spooling directory; corrupted or hand-edited spool files; custom patches to PartitionUpdate.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/a7140c5ac79c2072. Report an issue: GitHub.