prestodb/presto · error · IllegalArgumentException

Invalid value [%s]. Valid values: %s

Error message

Invalid value [%s]. Valid values: %s

What it means

ClickHouseTableProperties.enumProperty builds a table-property converter that parses a string into an enum by upper-casing it and calling Enum.valueOf. If the provided value is not a valid enum constant it throws IllegalArgumentException with the list of valid values. It is a table-property validation error thrown at planning time.

Source

Thrown at presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseTableProperties.java:151

    public static <T extends Enum<T>> PropertyMetadata<T> enumProperty(String name, String descriptionPrefix, Class<T> type, T defaultValue, Consumer<T> validation, boolean hidden)
    {
        String allValues = EnumSet.allOf(type).stream()
                .map(Enum::name)
                .collect(joining(", ", "[", "]"));
        return new PropertyMetadata<>(
                name,
                format("%s. Possible values: %s", descriptionPrefix, allValues),
                VARCHAR,
                type,
                defaultValue,
                hidden,
                value -> {
                    T enumValue;
                    try {
                        enumValue = Enum.valueOf(type, ((String) value).toUpperCase(ENGLISH));
                    }
                    catch (IllegalArgumentException e) {
                        throw new IllegalArgumentException(format("Invalid value [%s]. Valid values: %s", value, allValues), e);
                    }
                    validation.accept(enumValue);
                    return enumValue;
                },
                Enum::name);
    }
    public static PropertyMetadata<String> stringProperty(String name, String description, String defaultValue, boolean hidden)
    {
        return stringProperty(name, description, defaultValue, value -> {}, hidden);
    }

    public static PropertyMetadata<String> stringProperty(String name, String description, String defaultValue, Consumer<String> validation, boolean hidden)
    {
        return new PropertyMetadata<>(
                name,
                description,
                VARCHAR,
                String.class,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use one of the valid values listed in the error message
  2. Check the connector docs for supported table properties (e.g. engine values)
  3. Remove the property to accept the default
  4. Upgrade the connector if you need a newer property value

Example fix

// before
CREATE TABLE ch.db.t (x int) WITH (engine = 'mergetree')
// after
CREATE TABLE ch.db.t (x int) WITH (engine = 'MergeTree')
Defensive patterns

Strategy: validation

Validate before calling

// Validate table property values against allowed enums before DDL
Set<String> validEngines = Set.of("MERGETREE", "REPLACEDMERGETREE", "REPLICATEDMERGETREE", "TINYLOG", "LOG");
String engine = props.getProperty("engine").toUpperCase(Locale.ENGLISH);
if (!validEngines.contains(engine)) {
    throw new IllegalArgumentException("engine must be one of " + validEngines + ", got: " + engine);
}

Type guard

boolean isValidEnumValue(Class<? extends Enum<?>> type, String v) {
    try { Enum.valueOf(type, v.toUpperCase(Locale.ENGLISH)); return true; }
    catch (IllegalArgumentException e) { return false; }
}

Try / catch

try {
    createTableWithProperties(...);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Invalid value [")) {
        // surface valid values to the user / retry with corrected property
    } else throw e;
}

Prevention

When it happens

Trigger: Specifying an invalid value for a ClickHouse table property (e.g. an unknown engine name in WITH (engine = '...')) in CREATE TABLE or CREATE TABLE AS through the ClickHouse catalog.

Common situations: Typos in engine/property names; lowercase or abbreviated values not in the enum; copying table definitions that use properties unsupported by this connector version.

Related errors


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