prestodb/presto · error · InvalidTypeDefinitionException

Duplicate field:

Error message

Duplicate field: 

What it means

Thrown by checkDuplicateAndAdd while parsing a ROW type signature string: two fields in the row declaration share the same name (e.g. ROW(x bigint, x double)). Row field names must be unique, so the parser rejects the signature during type parsing.

Source

Thrown at presto-common/src/main/java/com/facebook/presto/common/type/TypeSignature.java:636

                    }
                    break;

                case FINISHED:
                    throw new IllegalStateException(format("Bad type signature: '%s'", signature));

                default:
                    throw new AssertionError(format("Unexpected RowTypeSignatureParsingState: %s", state));
            }
        }

        checkArgument(state == RowTypeSignatureParsingState.FINISHED, "Bad type signature: '%s'", signature);
        return new TypeSignature(signature.substring(0, StandardTypes.ROW.length()), fields);
    }

    private static void checkDuplicateAndAdd(Set<String> fieldNames, String fieldName)
    {
        if (!fieldNames.add(fieldName)) {
            throw new InvalidTypeDefinitionException("Duplicate field: " + fieldName);
        }
    }

    private static TypeSignatureParameter parseTypeOrNamedType(String typeOrNamedType, Set<String> literalParameters)
    {
        int split = typeOrNamedType.indexOf(' ');

        // Type without space or simple type with spaces
        if (split == -1 || SIMPLE_TYPE_WITH_SPACES.contains(typeOrNamedType)) {
            return TypeSignatureParameter.of(new NamedTypeSignature(Optional.empty(), parseTypeSignature(typeOrNamedType, literalParameters)));
        }

        // Assume the first part of a structured type always has non-alphabetical character.
        // If the first part is a valid identifier, parameter is a named field.
        String firstPart = typeOrNamedType.substring(0, split);
        if (IDENTIFIER_PATTERN.matcher(firstPart).matches()) {
            return TypeSignatureParameter.of(new NamedTypeSignature(
                    Optional.of(new RowFieldName(firstPart, false)),

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Rename duplicate fields in the ROW type declaration
  2. Sanitize generated field names (e.g. from DESCRIBE or schema inference) to be unique
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-common/src/main/java/com/facebook/presto/common/type/TypeSignature.java:636 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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