{"record":{"id":"f45a54df0db3f73d","repo":"hasura/graphql-engine","slug":"result-type-of-function-procedure-function-or-pro","errorCode":null,"errorMessage":"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:}","messagePattern":"Result type of function/procedure (.+?) is (.+?) but output type of command (.+?) is (.+?)","errorType":"validation","errorClass":"NDCValidationError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/ndc_validation.rs","lineNumber":115,"sourceCode":"    #[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,\n    },\n    #[error(\n        \"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:}\"\n    )]\n    FuncProcAndCommandScalarOutputTypeMismatch {\n        function_or_procedure_name: String,\n        function_or_procedure_output_type: String,\n        command_name: String,\n        command_output_type: String,\n    },\n    #[error(\n        \"Custom result type of function {function_or_procedure_name:} does not match custom output type of command: {command_name:}\"\n    )]\n    FuncProcAndCommandCustomOutputTypeMismatch {\n        function_or_procedure_name: String,\n        command_name: String,\n    },\n    #[error(\"data connector does not support queries\")]\n    QueryCapabilityUnsupported,\n    #[error(\"data connector does not support mutations\")]","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/ndc_validation.rs#L97-L133","documentation":"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.","triggerScenarios":"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.","commonSituations":"DB function signature drift; hand-written command metadata with wrong output type; connector version changing inferred types.","solutions":["Update the command's output type to match the function/procedure's actual result type","Or alter the function to return the declared type","Refresh connector schema and re-resolve after fixing"],"exampleFix":"# before\nkind: Command\nspec:\n  output_type: { scalar: String }  # function returns Float\n# after\nkind: Command\nspec:\n  output_type: { scalar: Float }","handlingStrategy":"validation","validationCode":"if command.output_is_scalar() {\n    assert_eq!(function.result_type.to_string(), command.output_type.to_string());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After altering DB function signatures, re-resolve metadata before deploying"],"tags":["command","output-type","type-mismatch","ndc"],"backgroundTag":"command-output-type-mismatch","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}