prestodb/presto · error · PrestoException
INVALID_SESSION_PROPERTY
INVALID_SESSION_PROPERTY
Error message
Allowed options for query_types_enabled_for_history_based_optimization are: %s
What it means
When configuring history-based optimization, FeaturesConfig parses the comma-separated query_types list by calling QueryType.valueOf on each entry; any unrecognized value (or null) throws PrestoException INVALID_SESSION_PROPERTY listing the allowed QueryType names. This guards the config key query_types_enabled_for_history_based_optimization.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java:1031
{
return queryTypesEnabledForHbo;
}
@Config("optimizer.query-types-enabled-for-hbo")
public FeaturesConfig setQueryTypesEnabledForHbo(String queryTypesEnabledForHbo)
{
this.queryTypesEnabledForHbo = parseQueryTypesFromString(queryTypesEnabledForHbo);
return this;
}
public static List<QueryType> parseQueryTypesFromString(String queryTypes)
{
try {
return Splitter.on(",").trimResults().splitToList(queryTypes).stream()
.map(QueryType::valueOf).collect(toImmutableList());
}
catch (Exception e) {
throw new PrestoException(INVALID_SESSION_PROPERTY, format("Allowed options for query_types_enabled_for_history_based_optimization are: %s",
Stream.of(QueryType.values())
.map(QueryType::name)
.collect(joining(","))));
}
}
public boolean isLogPlansUsedInHistoryBasedOptimizer()
{
return logPlansUsedInHistoryBasedOptimizer;
}
@Config("optimizer.log-plans-used-in-history-based-optimizer")
public FeaturesConfig setLogPlansUsedInHistoryBasedOptimizer(boolean logPlansUsedInHistoryBasedOptimizer)
{
this.logPlansUsedInHistoryBasedOptimizer = logPlansUsedInHistoryBasedOptimizer;
return this;
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Set the value to comma-separated QueryType enum names exactly as listed in the error message (e.g. SELECT,ANALYZE), uppercase, no invalid entries
- Remove the config key to use defaults if HBO filtering is not needed
- Check supported QueryType values for your Presto version before adding entries
Example fix
// before (features.properties) query_types_enabled_for_history_based_optimization=select, insert // after query_types_enabled_for_history_based_optimization=SELECT,ANALYZE
Defensive patterns
Strategy: validation
Validate before calling
List<String> allowed = Arrays.stream(QueryType.values()).map(Enum::name).collect(toList());
for (String qt : Splitter.on(',').trimResults().omitEmptyStrings().split(configValue)) {
if (!allowed.contains(qt)) {
throw new IllegalArgumentException("Invalid query type: " + qt + "; allowed: " + allowed);
}
} Try / catch
try {
bootstrapConfig();
} catch (PrestoException e) {
if (e.getErrorCode().getCode() == INVALID_SESSION_PROPERTY.toErrorCode().getCode()) {
throw new IllegalStateException("Fix query_types_enabled_for_history_based_optimization: " + e.getMessage(), e);
}
throw e;
} Prevention
- Use exact uppercase QueryType enum names in config
- Validate features.properties values before deployment
- Re-check allowed values after Presto upgrades
When it happens
Trigger: Setting query_types_enabled_for_history_based_optimization in features.properties (or setting the session property) to a value not exactly matching a QueryType enum name (SELECT, ANALYZE, ...), including typos, wrong case, or unsupported types like INSERT.
Common situations: Typo or lowercase query type in config file, copying a session property value that uses non-enum names, upgrading where the allowed set changed.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- NOT_SUPPORTED
- INVALID_COLUMN_MASK
- UNSUPPORTED_ANALYZER_TYPE
- INVALID_TABLE_PROPERTY
- ACCUMULO_TABLE_EXISTS
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/85ac5c17b669a9c8.
Report an issue: GitHub.