hasura/graphql-engine · error · NDCValidationError

Result type of function/procedure {function_or_procedure_nam

Error message

Result type of function/procedure {function_or_procedure_name:} is {function_or_procedure_output_type:} but output type of command {command_name:} is {command_output_type:}

What it means

The scalar result type declared by the NDC function/procedure differs from the output type declared for the command in metadata. The resolver compares the two and rejects mismatches so queries do not get unexpected shapes at runtime.

Source

Thrown at v3/crates/metadata-resolve/src/helpers/ndc_validation.rs:115

    #[error("mapping for type {type_name} of model {model_name} is not defined")]
    UnknownModelTypeMapping {
        model_name: Qualified<ModelName>,
        type_name: Qualified<CustomTypeName>,
    },
    #[error("mapping for type {type_name} of command {command_name} is not defined")]
    UnknownCommandTypeMapping {
        command_name: Qualified<CommandName>,
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "Field {field_name} for type {type_name} referenced in model {model_name} is not defined"
    )]
    UnknownTypeField {
        model_name: ModelName,
        type_name: CustomTypeName,
        field_name: FieldName,
    },
    #[error(
        "Result type of function/procedure {function_or_procedure_name:} is {function_or_procedure_output_type:} but output type of command {command_name:} is {command_output_type:}"
    )]
    FuncProcAndCommandScalarOutputTypeMismatch {
        function_or_procedure_name: String,
        function_or_procedure_output_type: String,
        command_name: String,
        command_output_type: String,
    },
    #[error(
        "Custom result type of function {function_or_procedure_name:} does not match custom output type of command: {command_name:}"
    )]
    FuncProcAndCommandCustomOutputTypeMismatch {
        function_or_procedure_name: String,
        command_name: String,
    },
    #[error("data connector does not support queries")]
    QueryCapabilityUnsupported,
    #[error("data connector does not support mutations")]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Update the command's output type to match the function/procedure's actual result type
  2. Or alter the function to return the declared type
  3. Refresh connector schema and re-resolve after fixing

Example fix

# before
kind: Command
spec:
  output_type: { scalar: String }  # function returns Float
# after
kind: Command
spec:
  output_type: { scalar: Float }
Defensive patterns

Strategy: validation

Validate before calling

if command.output_is_scalar() {
    assert_eq!(function.result_type.to_string(), command.output_type.to_string());
}

Prevention

When it happens

Trigger: A function returns Float in the connector schema but the command declares its output as the String scalar; changing the database function's return type without updating the command metadata.

Common situations: DB function signature drift; hand-written command metadata with wrong output type; connector version changing inferred types.

Related errors


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