prestodb/presto · error · PrestoException

INVALID_SESSION_PROPERTY

INVALID_SESSION_PROPERTY

Error message

Unable to parse session property: 

What it means

PrestoSparkQueryExecutionFactory parses submitted session property keys: system properties ('x=y', 1 part), catalog properties ('catalog.prop=value', 3 parts), and catalog session properties ('catalog.name=value', 2 parts). A key that splits into an unexpected number of dot-separated parts cannot be mapped to any of these and throws INVALID_SESSION_PROPERTY.

Source

Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/PrestoSparkQueryExecutionFactory.java:856

        return t instanceof PrestoSparkFatalException;
    }

    @VisibleForTesting
    static Session.SessionBuilder transferSessionPropertiesToSession(Session.SessionBuilder session, Map<String, String> sessionProperties)
    {
        sessionProperties.forEach((key, value) -> {
            // Presto session properties may also contain catalog properties in format catalog.property_name=value
            String[] parts = key.split("\\.");
            if (parts.length == 1) {
                // system property
                session.setSystemProperty(parts[0], value);
            }
            else if (parts.length == 2) {
                // catalog property
                session.setCatalogSessionProperty(parts[0], parts[1], value);
            }
            else {
                throw new PrestoException(INVALID_SESSION_PROPERTY, "Unable to parse session property: " + key);
            }
        });

        return session;
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Format the key as 'catalog.propertyName' for catalog session properties or use a plain system property name without a catalog prefix
  2. Remove or rename keys with more than two dot-separated segments before submission
  3. Check the client SDK/API docs for how session properties are encoded when launching Presto on Spark queries

Example fix

// before (3-part ambiguous key)
properties.put("hive.bucket.exec_max_threads", "4"); // ok, but "hive.mydb.prop.x" fails
// after: valid catalog session property form
properties.put("hive.max_initial_split_size", "32MB");
// catalog session property: "hive.mydb.prop" (catalog= Catalog.property)
Defensive patterns

Strategy: validation

Validate before calling

for (String key : sessionProperties.keySet()) {
    String[] parts = key.split("\\.");
    boolean valid = parts.length == 1
        || parts.length == 3                       // catalog.name.property
        || (parts.length == 2);                    // catalog.property
    if (!valid) throw new IllegalArgumentException("Invalid session property key: " + key);
}

Type guard

boolean isValidSessionPropertyKey(String key) {
    if (key == null || key.isEmpty()) return false;
    int parts = key.split("\\.", -1).length;
    return parts >= 1 && parts <= 3 && !key.contains("..");
}

Try / catch

try {
    QueryExecution qe = factory.create(config);
} catch (PrestoException e) {
    if ("INVALID_SESSION_PROPERTY".equals(e.getErrorCode().getName())
            && e.getMessage().startsWith("Unable to parse session property")) {
        // drop/rename the offending key and resubmit
    } else throw e;
}

Prevention

When it happens

Trigger: Submitting a Spark query whose session config contains a property key that is neither a plain system property nor of the form 'catalog.property' or 'catalog.name.property' — e.g. an empty key, a key with two dots like 'catalog.name.extra.prop', or a misplaced dot.

Common situations: Setting catalog session properties with wrong syntax (extra dot segment); forwarding arbitrary Spark/Hadoop-style dotted keys as session properties; typos like 'db.catalog..prop'.

Understand the failure class

Related errors


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