{"record":{"id":"a7140c5ac79c2072","repo":"prestodb/presto","slug":"unsupported-update-mode-s","errorCode":null,"errorMessage":"Unsupported update mode: %s","messagePattern":"Unsupported update mode: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java","lineNumber":2378,"sourceCode":"                        columnTypes,\n                        getColumnStatistics(session, partitionComputedStatistics, partitionName, partitionValues, partitionTypes),\n                        timeZone);\n\n                // New partition or overwriting existing partition by staging and moving the new partition\n                if (!isExistingPartition || handle.getLocationHandle().getWriteMode() != DIRECT_TO_TARGET_EXISTING_DIRECTORY) {\n                    metastore.addPartition(\n                            session,\n                            handle.getSchemaName(),\n                            handle.getTableName(),\n                            table.getStorage().getLocation(),\n                            false,\n                            partition,\n                            partitionUpdate.getWritePath(),\n                            partitionStatistics);\n                }\n            }\n            else {\n                throw new IllegalArgumentException(format(\"Unsupported update mode: %s\", partitionUpdate.getUpdateMode()));\n            }\n        }\n\n        return Optional.of(new HiveOutputMetadata(new HiveOutputInfo(\n                partitionUpdates.stream()\n                        .map(PartitionUpdate::getName)\n                        .map(name -> name.isEmpty() ? UNPARTITIONED_ID.getPartitionName() : name)\n                        .collect(toList()), table.getStorage().getLocation())));\n    }\n\n    /**\n     * Deletes all the files not written by the current query from the given partition path.\n     * This is required when we are overwriting the partitions by directly writing the new\n     * files to the existing directory, where files written by older queries may be present too.\n     *\n     * @param session the ConnectorSession object\n     * @param partitionPath the path of the partition from where the older files are to be deleted\n     */","sourceCodeStart":2360,"sourceCodeEnd":2396,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java#L2360-L2396","documentation":"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.","triggerScenarios":"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.","commonSituations":"Coordinator and worker running different Presto versions sharing a spooling directory; corrupted or hand-edited spool files; custom patches to PartitionUpdate.","solutions":["Verify all coordinators and workers run the same Presto version and restart the cluster consistently","Clear stale spooling directories and rerun the failed query","Inspect the PartitionUpdate source (serialization/custom code) for an invalid updateMode and fix the producer; report the bug if it comes from stock Presto"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Validate updateMode before finalizing metadata writes\nSet<String> supported = Set.of(\"NEW_TABLE\", \"APPEND\", \"OVERWRITE\");\nif (!supported.contains(partitionUpdate.getUpdateMode().name())) {\n    throw new IllegalStateException(\"Unsupported update mode: \" + partitionUpdate.getUpdateMode());\n}","typeGuard":"static boolean isSupportedUpdateMode(PartitionUpdate p) {\n    return p != null && p.getUpdateMode() != null\n        && (p.getUpdateMode() == UpdateMode.NEW_TABLE\n         || p.getUpdateMode() == UpdateMode.APPEND\n         || p.getUpdateMode() == UpdateMode.OVERWRITE);\n}","tryCatchPattern":"try {\n    commitPartitionUpdates(partitionUpdates);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unsupported update mode\")) {\n        // investigate version skew / spool files; do not blind-retry\n    } else { throw e; }\n}","preventionTips":["Keep all Presto nodes on the same version","Avoid sharing spooling directories across clusters of different versions","Add invariant checks where PartitionUpdate objects are produced or deserialized"],"tags":["hive","internal","update-mode","illegal-argument"],"backgroundTag":"unsupported-update-mode","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"}