{"record":{"id":"2778fb509e889cd8","repo":"hasura/graphql-engine","slug":"type-0-is-not-defined-in-the-agent-schema","errorCode":null,"errorMessage":"type {0} is not defined in the agent schema","messagePattern":"type (.+?) is not defined in the agent schema","errorType":"validation","errorClass":"NDCValidationError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/ndc_validation.rs","lineNumber":95,"sourceCode":"    )]\n    ColumnTypeDoesNotMatch {\n        db_name: DataConnectorName,\n        model_name: ModelName,\n        field_name: FieldName,\n        collection_name: CollectionName,\n        column_name: DataConnectorColumnName,\n        field_type: String,\n        column_type: String,\n    },\n    #[error(\n        \"internal error: data connector does not define the scalar type {type}, used by field {field_name} in model {model_name}\"\n    )]\n    TypeCapabilityNotDefined {\n        model_name: ModelName,\n        field_name: FieldName,\n        r#type: String,\n    },\n    #[error(\"type {0} is not defined in the agent schema\")]\n    NoSuchType(String),\n    #[error(\"mapping for type {type_name} of model {model_name} is not defined\")]\n    UnknownModelTypeMapping {\n        model_name: Qualified<ModelName>,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\"mapping for type {type_name} of command {command_name} is not defined\")]\n    UnknownCommandTypeMapping {\n        command_name: Qualified<CommandName>,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"Field {field_name} for type {type_name} referenced in model {model_name} is not defined\"\n    )]\n    UnknownTypeField {\n        model_name: ModelName,\n        type_name: CustomTypeName,\n        field_name: FieldName,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/ndc_validation.rs#L77-L113","documentation":"A type referenced in mappings or capabilities is not present in the agent (sub)graph's type schema. The NDC validation stage resolves every referenced type name against the set of types declared in OpenDD metadata.","triggerScenarios":"Referencing a custom type name in a model/command mapping that is not declared by any Type/ObjectType definition; misspelling a type name; deleting a type definition while it is still referenced.","commonSituations":"Renaming or removing an object type without updating references; ordering issues where a type is expected but was never authored; copy-paste errors in type names.","solutions":["Declare the missing type (add the corresponding type definition to the metadata)","Fix the reference to point at an existing, correctly-spelled type name","Search the metadata for all usages of the type name and ensure the definition exists in the same subgraph"],"exampleFix":"# before\n# referenced: type: app.User  (no such type defined)\n# after\nkind: ObjectType\napiVersion: graphql.hasura.io/v1alpha1\nmetadata:\n  name: User\n  ...","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn type_defined(name: &QualifiedTypeName, types: &TypeSet) -> bool { types.contains(name) }","tryCatchPattern":null,"preventionTips":["Reference types only after their definitions exist in the same metadata set"],"tags":["types","schema","agent-schema","validation"],"backgroundTag":"undefined-type-reference","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}