{"record":{"id":"f5683a85537878de","repo":"prestodb/presto","slug":"duplicate-field","errorCode":null,"errorMessage":"Duplicate field: ","messagePattern":"Duplicate field: ","errorType":"validation","errorClass":"InvalidTypeDefinitionException","httpStatus":null,"severity":"error","filePath":"presto-common/src/main/java/com/facebook/presto/common/type/TypeSignature.java","lineNumber":636,"sourceCode":"                    }\n                    break;\n\n                case FINISHED:\n                    throw new IllegalStateException(format(\"Bad type signature: '%s'\", signature));\n\n                default:\n                    throw new AssertionError(format(\"Unexpected RowTypeSignatureParsingState: %s\", state));\n            }\n        }\n\n        checkArgument(state == RowTypeSignatureParsingState.FINISHED, \"Bad type signature: '%s'\", signature);\n        return new TypeSignature(signature.substring(0, StandardTypes.ROW.length()), fields);\n    }\n\n    private static void checkDuplicateAndAdd(Set<String> fieldNames, String fieldName)\n    {\n        if (!fieldNames.add(fieldName)) {\n            throw new InvalidTypeDefinitionException(\"Duplicate field: \" + fieldName);\n        }\n    }\n\n    private static TypeSignatureParameter parseTypeOrNamedType(String typeOrNamedType, Set<String> literalParameters)\n    {\n        int split = typeOrNamedType.indexOf(' ');\n\n        // Type without space or simple type with spaces\n        if (split == -1 || SIMPLE_TYPE_WITH_SPACES.contains(typeOrNamedType)) {\n            return TypeSignatureParameter.of(new NamedTypeSignature(Optional.empty(), parseTypeSignature(typeOrNamedType, literalParameters)));\n        }\n\n        // Assume the first part of a structured type always has non-alphabetical character.\n        // If the first part is a valid identifier, parameter is a named field.\n        String firstPart = typeOrNamedType.substring(0, split);\n        if (IDENTIFIER_PATTERN.matcher(firstPart).matches()) {\n            return TypeSignatureParameter.of(new NamedTypeSignature(\n                    Optional.of(new RowFieldName(firstPart, false)),","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common/src/main/java/com/facebook/presto/common/type/TypeSignature.java#L618-L654","documentation":"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.","triggerScenarios":"Thrown at presto-common/src/main/java/com/facebook/presto/common/type/TypeSignature.java:636 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename duplicate fields in the ROW type declaration","Sanitize generated field names (e.g. from DESCRIBE or schema inference) to be unique"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}