{"record":{"id":"44ba6f98ec02176f","repo":"hasura/graphql-engine","slug":"multiple-output-type-permissions-have-been-defined","errorCode":null,"errorMessage":"multiple output type permissions have been defined for type: {type_name:}","messagePattern":"multiple output type permissions have been defined for type: (.+?)","errorType":"validation","errorClass":"TypeOutputPermissionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/type_permissions/error.rs","lineNumber":13,"sourceCode":"use crate::helpers::typecheck::{self, TypecheckIssue};\nuse crate::types::error::{ContextualError, Error, ShouldBeAnError};\nuse open_dds::types::{CustomTypeName, FieldName};\n\nuse crate::types::subgraph::Qualified;\n\n#[derive(Debug, thiserror::Error)]\npub enum TypeOutputPermissionError {\n    #[error(\n        \"unsupported type in output type permissions definition: {type_name:}; only object types are supported\"\n    )]\n    UnsupportedTypeInOutputPermissions { type_name: CustomTypeName },\n    #[error(\"multiple output type permissions have been defined for type: {type_name:}\")]\n    DuplicateOutputTypePermissions { type_name: CustomTypeName },\n    #[error(\"unknown type used in output permissions: {type_name:}\")]\n    UnknownTypeInOutputPermissionsDefinition {\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\"unknown field '{field_name:}' used in output permissions of type '{type_name:}'\")]\n    UnknownFieldInOutputPermissionsDefinition {\n        field_name: FieldName,\n        type_name: Qualified<CustomTypeName>,\n    },\n}\n\nimpl ContextualError for TypeOutputPermissionError {\n    fn create_error_context(&self) -> Option<error_context::Context> {\n        None\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/type_permissions/error.rs#L1-L31","documentation":"The metadata resolver found two or more output type permission definitions for the same object type. OpenDD output permissions are a single logical document per type, so duplicates are ambiguous and rejected.","triggerScenarios":"Having two OpenDD documents (or two entries within one document) both defining outputTypePermissions for the same qualified typeName in the same subgraph.","commonSituations":"Copy-pasting a permission document and forgetting to change typeName, merging branches that each added a permission for the same type, or iterating on permissions in a separate file that duplicates an existing one.","solutions":["Search the metadata sources for all definitions of outputTypePermissions referencing the offending typeName","Delete or rename the duplicate so exactly one output permission definition exists per type","If different roles need different rules, combine them into one definition using multiple filter sets / roles rather than duplicating the document"],"exampleFix":"# before\n# doc1.yaml\ntypeName: { name: User }\noutputTypePermissions: { ... }\n# doc2.yaml (duplicate)\ntypeName: { name: User }\noutputTypePermissions: { ... }\n\n# after\n# keep only doc1.yaml; delete doc2.yaml or merge its rules into doc1.yaml","handlingStrategy":"validation","validationCode":"// collect outputTypePermissions by typeName and assert uniqueness\nlet mut seen = HashSet::new();\nfor d in docs.output_permission_docs() {\n    if !seen.insert(d.type_name.clone()) {\n        return Err(format!(\"duplicate output permissions for {}\", d.type_name));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run a uniqueness lint over permission documents keyed by typeName","Avoid copy-pasting permission files without renaming the type"],"tags":["opendd","metadata","permissions","duplicate"],"backgroundTag":"duplicate-definition","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}