hasura/graphql-engine · error · ArgumentPresetExecutionError

no field definition found for field '{field_name}' of object

Error message

no field definition found for field '{field_name}' of object type '{object_type_name}'

What it means

FieldDefinitionNotFound is thrown when the planner looks up the definition of a field on an object type and the field does not exist at all. Unlike FieldMappingNotFound (field exists but has no connector mapping), this error means the field name is not present in the type's field definitions.

Source

Thrown at v3/crates/plan/src/query/arguments.rs:407

    #[error("command permissions for command {command_name} not found for role {role}")]
    CommandArgumentPresetsNotFound {
        command_name: Qualified<CommandName>,
        role: Role,
    },
    #[error("argument mapping not found for {argument_name}")]
    ArgumentMappingNotFound { argument_name: ArgumentName },
    #[error("type mapping not found for object {object_type_name}")]
    TypeMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "no data connector field mapping found for field '{field_name}' of object type '{object_type_name}'"
    )]
    FieldMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
    },
    #[error(
        "no field definition found for field '{field_name}' of object type '{object_type_name}'"
    )]
    FieldDefinitionNotFound {
        object_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
    },
    #[error(
        "no data connector field mapping found for field '{field_name}' of object type '{object_type_name}'"
    )]
    DataConnectorFieldMappingNotFound {
        object_type_name: Qualified<CustomTypeName>,
        field_name: FieldName,
    },
    #[error("{0}")]
    MapFieldNamesError(#[from] MapFieldNamesError),
}

impl TraceableError for ArgumentPresetExecutionError {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check that the named field actually exists in the field definitions of the named object type
  2. Fix typos/casing in the requesting query or preset
  3. Update clients after a field rename/removal
  4. Regenerate the schema-facing types from current metadata

Example fix

// before
query { users { emails } }
// after
query { users { email } }
Defensive patterns

Strategy: type-guard

Validate before calling

fn field_is_defined(metadata: &Metadata, t: &Qualified<CustomTypeName>, f: &FieldName) -> bool {
    metadata.object_types.get(t)
        .map(|o| o.fields.contains_key(f)).unwrap_or(false)
}

Type guard

fn is_field_definition_not_found(e: &ArgumentPresetExecutionError) -> bool {
    matches!(e, ArgumentPresetExecutionError::FieldDefinitionNotFound { .. })
}

Try / catch

match result {
    Err(PlanError::Arguments(ArgumentPresetExecutionError::FieldDefinitionNotFound { object_type_name, field_name })) => {
        bad_request(format!("unknown field {field_name} on {object_type_name}"));
    }
    other => other,
}

Prevention

When it happens

Trigger: Planning references a field that is not defined on the object type — e.g. a query selects a field that was removed, or an argument preset references a field name with a typo or the wrong casing.

Common situations: Schema evolution where a field was renamed or removed but clients still request it; copy-paste of queries between types; casing mismatches between GraphQL field names and metadata keys.

Related errors


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