prestodb/presto · error · IllegalArgumentException

(JsonMappingException cause message)

Error message

(JsonMappingException cause message)

What it means

FileSessionPropertyManager wraps Jackson's JsonMappingException (other than unrecognized-property cases) when parsing the session properties JSON file. The underlying cause message (with the 'through reference chain' noise stripped) is rethrown as an IllegalArgumentException. It signals the JSON is structurally invalid for the target type: wrong value types, invalid enum values, etc.

Source

Thrown at presto-file-session-property-manager/src/main/java/com/facebook/presto/session/file/FileSessionPropertyManager.java:72

        catch (IOException e) {
            throw new UncheckedIOException(e);
        }
        catch (IllegalArgumentException e) {
            Throwable cause = e.getCause();
            if (cause instanceof UnrecognizedPropertyException) {
                UnrecognizedPropertyException ex = (UnrecognizedPropertyException) cause;
                String message = format("Unknown property at line %s:%s: %s",
                        ex.getLocation().getLineNr(),
                        ex.getLocation().getColumnNr(),
                        ex.getPropertyName());
                throw new IllegalArgumentException(message, e);
            }
            if (cause instanceof JsonMappingException) {
                // remove the extra "through reference chain" message
                if (cause.getCause() != null) {
                    cause = cause.getCause();
                }
                throw new IllegalArgumentException(cause.getMessage(), e);
            }
            throw e;
        }
    }

    @Override
    protected List<SessionMatchSpec> getSessionMatchSpecs()
    {
        return sessionMatchSpecs;
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Read the cause message to find the offending property and fix its value/type in the config file
  2. Validate the JSON against the expected session property types (booleans, sizes, durations as correct types)
  3. Regenerate or simplify the config file to a known-good baseline and add properties incrementally

Example fix

// before
{"query_max_run_time": "100m"}   // expects a duration string? type error if class expects long
// after (match declared type)
{"query_max_run_time": "100m"}  // verify against the @Config-annotated field's expected type
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate JSON structure and value types against the expected schema
try (InputStream in = new FileInputStream(configFile)) {
  JsonNode root = mapper.readTree(in);
  root.fields().forEachRemaining(e -> checkType(e.getKey(), e.getValue()));
}

Type guard

boolean hasExpectedType(JsonNode node, Class<?> expected) {
  if (expected == boolean.class) return node.isBoolean();
  if (expected == long.class) return node.canConvertToLong();
  if (expected == String.class) return node.isTextual();
  return false;
}

Try / catch

try { manager = new FileSessionPropertyManager(configFile); }
catch (IllegalArgumentException e) {
  Throwable root = e; while (root.getCause() != null) root = root.getCause();
  log.error("Config binding failed: " + root.getMessage());
  throw e;
}

Prevention

When it happens

Trigger: A config file whose JSON is syntactically valid but fails binding: e.g. a string where a number/boolean is expected, an invalid enum value for a property, or nested structure mismatch.

Common situations: Hand-edited config files with wrong value types ("true" as string vs boolean); values like "1h" for a property expecting a plain number or data size; config generated by tooling after schema changes.

Related errors


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