{"record":{"id":"3609f62a3931c556","repo":"hasura/graphql-engine","slug":"duplicate-field-name-field-name-generated-while","errorCode":null,"errorMessage":"duplicate field name {field_name} generated while building object type {type_name}","messagePattern":"duplicate field name (.+?) generated while building object type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/schema/src/lib.rs","lineNumber":321,"sourceCode":"    InternalObjectTypeFieldNotFound {\n        type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n    },\n    #[error(\n        \"internal error while building schema, role {role} not found in argument presets for model {model_name}\"\n    )]\n    InternalModelArgumentPresetLookupFailure {\n        model_name: Qualified<ModelName>,\n        role: Role,\n    },\n    #[error(\n        \"internal error while building schema, role {role} not found in argument presets for command {command_name}\"\n    )]\n    InternalCommandArgumentPresetLookupFailure {\n        command_name: Qualified<CommandName>,\n        role: Role,\n    },\n    #[error(\"duplicate field name {field_name} generated while building object type {type_name}\")]\n    DuplicateFieldNameGeneratedInObjectType {\n        field_name: ast::Name,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"field name for relationship {relationship_name} of type {type_name} conflicts with the existing field {field_name}\"\n    )]\n    RelationshipFieldNameConflict {\n        relationship_name: RelationshipName,\n        field_name: ast::Name,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"the aggregation function {field_name} conflicts with the aggregatable field {field_name} in the aggregate expression {aggregate_expression} is named {field_name}. Either rename the aggregation function or the field\"\n    )]\n    AggregationFunctionFieldNameConflict {\n        aggregate_expression: Qualified<AggregateExpressionName>,\n        field_name: ast::Name,","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/schema/src/lib.rs#L303-L339","documentation":"Internal schema-build error: while generating the object type for a model, two generated fields ended up with the same name. The generator creates fields for columns, relationships, commands, etc., and a naming collision was detected via a name→field map insert.","triggerScenarios":"Building the GraphQL schema when a model has a column and a relationship (or command/aggregate field) whose generated GraphQL field names collide, e.g. a column `posts` and a relationship also named `posts`.","commonSituations":"Naming a relationship the same as an existing column, custom GraphQL field name overrides in metadata that clash, or command names colliding with column names.","solutions":["Rename the relationship/command/custom field in metadata so its generated field name differs from the colliding field","Check the reported field_name and type_name to identify which two producers generated it","Remove any custom field_name overrides that duplicate an existing field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Scan model metadata for generated-name collisions before building\nlet mut seen = HashSet::new();\nfor f in columns_fields.iter().chain(rel_fields.iter()).chain(cmd_fields.iter()) {\n    assert!(seen.insert(f.graphql_name()), \"duplicate field {}\", f.graphql_name());\n}","typeGuard":null,"tryCatchPattern":"// Catch Error::DuplicateFieldNameGeneratedInObjectType { field_name, type_name, .. } and rename the offending metadata object","preventionTips":["Don't name relationships/commands the same as columns","Run schema build in CI on metadata changes"],"tags":["schema-generation","naming-conflict","hasura","metadata"],"backgroundTag":"graphql-schema-field-name-collision","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}