{"record":{"id":"1763a4941994f7f4","repo":"hasura/graphql-engine","slug":"field-name-for-relationship-relationship-name-of","errorCode":null,"errorMessage":"field name for relationship {relationship_name} of type {type_name} conflicts with the existing field {field_name}","messagePattern":"field name for relationship (.+?) of type (.+?) conflicts with the existing field (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/schema/src/lib.rs","lineNumber":326,"sourceCode":"        \"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,\n    },\n    #[error(\n        \"internal error: duplicate aggregatable field {field_name} in the aggregate expression {aggregate_expression} is named {field_name}\"\n    )]\n    InternalDuplicateAggregatableField {","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/schema/src/lib.rs#L308-L344","documentation":"Schema-build error specifically for relationships: the field name configured (or defaulted) for a relationship on an object type collides with a field that already exists on that type (e.g. a column field). The relationship cannot be added without overwriting an existing field.","triggerScenarios":"Metadata defines a relationship on a model whose name (or mapped field name) equals an existing field of the same object type — commonly a column or another relationship with the same name.","commonSituations":"Relationship named identically to a column (e.g. both `author`), renaming fields in metadata so they clash, foreign-key relationships defaulting to the same name as a column.","solutions":["Rename the relationship (or set its GraphQL field name) in metadata so it differs from the existing field","Alternatively rename/override the conflicting column's field name","Check for duplicate relationship definitions targeting the same field name"],"exampleFix":"# before (metadata yaml)\nrelationships:\n  author: ...\n# with a column also named author\n# after\nrelationships:\n  writer: ...\n  # or map the column to a different field name","handlingStrategy":"validation","validationCode":"// Before build: relationship names must not collide with the model's field names\nlet field_names: HashSet<&str> = model_fields(model);\nfor rel in &model.relationships {\n    assert!(!field_names.contains(rel.field_name()), \"relationship {} conflicts\", rel.name());\n}","typeGuard":null,"tryCatchPattern":"// Catch Error::RelationshipFieldNameConflict { relationship_name, field_name, .. } and rename the relationship in metadata","preventionTips":["Prefix relationship names distinctly from columns","Validate metadata in CI with a schema build"],"tags":["schema-generation","relationship","name-conflict","hasura"],"backgroundTag":"graphql-schema-field-name-collision","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}