hasura/graphql-engine · error · TypeError::NoNamedTypeFound

expected to find a custom named type in {qualified_type_refe

Error message

expected to find a custom named type in {qualified_type_reference:} but none found

What it means

Thrown by the metadata-resolve crate when resolving a value expression for an argument: the expression's type was expected to resolve to a custom named type (QualifiedTypeReference) but no such named type was found in the resolved metadata. This indicates the metadata refers to a type name that was never defined or not visible in the current subgraph.

Source

Thrown at v3/crates/metadata-resolve/src/types/error.rs:711

            TypePredicateError::ExpectedObjectType { field_type, field_name } => {
                Some(Context::from_step(
                    Step {
                        message: format!("Expected field '{field_name}' to have an object type but instead found '{field_type}'"),
                        path: field_name.path.clone(),
                        subgraph: field_type.get_subgraph().cloned(),
                    }
                ))
            }

            TypePredicateError::ScalarBooleanExpressionTypeError(error) => error.create_error_context(),
            _ => None
        }
    }
}

#[derive(Debug, thiserror::Error)]
pub enum TypeError {
    #[error("expected to find a custom named type in {qualified_type_reference:} but none found")]
    NoNamedTypeFound {
        qualified_type_reference: QualifiedTypeReference,
    },
    #[error("type mismatch: {error:}")]
    TypeCheckError { error: TypecheckError },
}

impl From<AggregateExpressionError> for Error {
    fn from(val: AggregateExpressionError) -> Self {
        Error::AggregateExpressionError(val)
    }
}

impl From<TypecheckError> for Error {
    fn from(type_error: TypecheckError) -> Self {
        Error::TypeError {
            type_error: TypeError::TypeCheckError { error: type_error },
        }

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the type name exists in the same subgraph's types.hml and is spelled identically
  2. If the type lives in another subgraph, add the appropriate import (e.g. @foobar(...) / object type import) so it resolves locally
  3. Re-run metadata resolve after fixing; check ndc-spec types vs custom object types are not mixed up

Example fix

// before
command MyCommand {
  argument: someTypeNotDefinedLocally
}
// after
// define/import the type first
object type SomeType { ... }
command MyCommand {
  argument: SomeType
}
Defensive patterns

Strategy: validation

Validate before calling

// Before resolving, check the type exists in resolved metadata
let exists = resolved_metadata
    .types
    .contains_key(&qualified_type_reference.custom_type_name);
if !exists { /* fail fast with a clear message */ }

Try / catch

match resolve_value_expression_for_argument(...) {
    Err(e) if matches!(e.type_error, TypeError::NoNamedTypeFound { .. }) => {
        // surface which QualifiedTypeReference is missing and fail the build
    }
    r => r,
}

Prevention

When it happens

Trigger: Resolving an argument's value expression (resolve_value_expression_for_argument in metadata-resolve/src/helpers/argument.rs) where the declared type reference points to a Qualified<CustomTypeName> that does not exist among the resolved types (e.g. a command/argument typed with an object type defined in a different subgraph or misspelled in the dds file).

Common situations: Referencing an object type in a command argument or type predicate that lives in another subgraph without an @foobar import; renaming a type in data.hml without updating references; typos in qualified type names.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/76dc163fa8f4aefa. Report an issue: GitHub.