{"record":{"id":"d1b5bfea9c1d9502","repo":"hasura/graphql-engine","slug":"the-following-type-is-defined-more-than-once-nam-d1b5bf","errorCode":null,"errorMessage":"the following type is defined more than once: {name:}","messagePattern":"the following type is defined more than once: (.+?)","errorType":"validation","errorClass":"ScalarTypesError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/scalar_types/error.rs","lineNumber":10,"sourceCode":"use crate::stages::graphql_config;\nuse crate::types::error::ContextualError;\nuse crate::types::subgraph::Qualified;\nuse open_dds::types::CustomTypeName;\n\n#[derive(Debug, thiserror::Error)]\npub enum ScalarTypesError {\n    #[error(\"{0}\")]\n    GraphqlConfigError(#[from] graphql_config::GraphqlConfigError),\n    #[error(\"the following type is defined more than once: {name:}\")]\n    DuplicateTypeDefinition { name: Qualified<CustomTypeName> },\n}\n\nimpl ContextualError for ScalarTypesError {\n    fn create_error_context(&self) -> Option<error_context::Context> {\n        match self {\n            ScalarTypesError::GraphqlConfigError(_)\n            | ScalarTypesError::DuplicateTypeDefinition { .. } => None,\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/scalar_types/error.rs#L1-L22","documentation":"Two scalar type definitions in the metadata have the same qualified name (subgraph + CustomTypeName), which is ambiguous.","triggerScenarios":"Declaring the same custom scalar type name in the same subgraph in two different metadata documents (or twice in one document).","commonSituations":"Merging metadata files that both define a type, or re-adding a type under a different document without renaming.","solutions":["Rename one of the duplicate scalar type definitions","Remove the redundant type definition","Split types into distinct subgraphs if the duplication is intentional namespacing"],"exampleFix":"// before\n# doc1.k8s.yaml and doc2.k8s.yaml both define\nkind: ScalarType\nname: my_scalar\n// after\n# rename in doc2\nkind: ScalarType\nname: my_scalar_v2","handlingStrategy":"validation","validationCode":"let mut seen = HashSet::new();\nfor st in &metadata_accessor.scalar_types {\n    if !seen.insert(st.name.clone()) {\n        return Err(format!(\"duplicate scalar type: {}\", st.name));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce unique qualified names across all metadata documents","Add duplicate-name lint to CI"],"tags":["duplicate","scalar-type","metadata","naming"],"backgroundTag":"duplicate-definition","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}