prestodb/presto · error · IllegalArgumentException

Enum definition expected, got %s

Error message

Enum definition expected, got %s

What it means

BigintEnumParametricType.createType expects its single type parameter to be a long enum map definition; if the parameter is anything else (not an enum definition), the private checkArgument helper throws IllegalArgumentException with 'Enum definition expected, got %s'. This ensures BIGINT ENUM types are only constructed from a proper enum map parameter.

Source

Thrown at presto-common/src/main/java/com/facebook/presto/common/type/BigintEnumParametricType.java:47

    {
        return StandardTypes.BIGINT_ENUM;
    }

    @Override
    public Type createType(List<TypeParameter> parameters)
    {
        checkArgument(parameters.size() == 1, "Enum type expects exactly one parameter, got %s", parameters);
        checkArgument(
                parameters.get(0).getKind() == ParameterKind.LONG_ENUM,
                "Enum definition expected, got %s",
                parameters);
        return new BigintEnumType(parameters.get(0).getLongEnumMap());
    }

    private static void checkArgument(boolean argument, String format, Object... args)
    {
        if (!argument) {
            throw new IllegalArgumentException(format(format, args));
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Build BIGINT ENUM signatures via the LongEnumMap-based TypeSignatureParameter.of(...) helpers
  2. Inspect the TypeSignature being passed and confirm parameter 0 is an enum definition
  3. Update/align plugin and server versions so the parameter encoding matches

Example fix

// before
TypeSignature sig = new TypeSignature("BIGINT ENUM", singletonList(TypeSignatureParameter.of(42L)));
// after
TypeSignature sig = new TypeSignature("BIGINT ENUM", singletonList(TypeSignatureParameter.of(longEnumMap))); // longEnumMap is a LongEnumMap definition
Defensive patterns

Strategy: type-guard

Validate before calling

TypeSignatureParameter p = signature.getParameters().get(0);
if (p.getKind() != ParameterKind.LONG_ENUM_MAP) {
    throw new IllegalArgumentException("BIGINT ENUM requires a LongEnumMap parameter, got " + p.getKind());
}

Type guard

public static boolean isEnumDefinition(TypeSignatureParameter p) {
    return p != null && p.getKind() == ParameterKind.LONG_ENUM_MAP;
}

Try / catch

try {
    Type t = bigintEnumParametricType.createType(parameters);
} catch (IllegalArgumentException e) {
    logger.error("Bad enum parameter: %s", e.getMessage());
    // rebuild signature with proper LongEnumMap
}

Prevention

When it happens

Trigger: Registering or creating a BIGINT ENUM type whose TypeSignatureParameter is not a LongEnumMap (e.g. a plain long, a variable name, or a different parameter kind is passed to createType).

Common situations: Plugin or connector code hand-building TypeSignatures for enum types instead of using the enum helpers; a serialized/round-tripped type signature losing its enum map parameter; version mismatch where a plugin sends parameters in a different order/kind.

Related errors


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