{"record":{"id":"462894ecda71e60f","repo":"hasura/graphql-engine","slug":"command-command-name-does-not-have-a-source-defi","errorCode":null,"errorMessage":"command {command_name} does not have a source defined","messagePattern":"command (.+?) does not have a source defined","errorType":"error_code","errorClass":"ArgumentPresetExecutionError","httpStatus":null,"severity":"error","filePath":"v3/crates/plan/src/query/arguments.rs","lineNumber":385,"sourceCode":"    GotObject {\n        expected_type: QualifiedTypeReference,\n    },\n    #[error(\"expected {expected_type} but got an array\")]\n    GotArray {\n        expected_type: QualifiedTypeReference,\n    },\n    #[error(\n        \"could not convert the provided header value to string as it contains non-visible ASCII characters\"\n    )]\n    IllegalCharactersInHeaderValue,\n    #[error(\"Model source not found for model '{model_name}'\")]\n    ModelSourceNotFound { model_name: Qualified<ModelName> },\n    #[error(\"Model permissions for model {model_name} not found for role {role}\")]\n    ModelArgumentPresetsNotFound {\n        role: Role,\n        model_name: Qualified<ModelName>,\n    },\n    #[error(\"command {command_name} does not have a source defined\")]\n    CommandSourceNotFound {\n        command_name: Qualified<CommandName>,\n    },\n    #[error(\"command permissions for command {command_name} not found for role {role}\")]\n    CommandArgumentPresetsNotFound {\n        command_name: Qualified<CommandName>,\n        role: Role,\n    },\n    #[error(\"argument mapping not found for {argument_name}\")]\n    ArgumentMappingNotFound { argument_name: ArgumentName },\n    #[error(\"type mapping not found for object {object_type_name}\")]\n    TypeMappingNotFound {\n        object_type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"no data connector field mapping found for field '{field_name}' of object type '{object_type_name}'\"\n    )]\n    FieldMappingNotFound {","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plan/src/query/arguments.rs#L367-L403","documentation":"CommandSourceNotFound is thrown when planning a command (a custom operation backed by a data connector) whose metadata lacks a source definition. Commands must declare where they execute; if the source block is missing or unresolved, the planner aborts with this error naming the Qualified<CommandName>.","triggerScenarios":"Planning a query that invokes a command whose metadata entry has no source (e.g. a command defined with only argument mappings or a typo'd/unresolved source reference).","commonSituations":"Defining a command but omitting or misindenting its source block; renaming a command without updating callers; metadata schema changes between versions that made command sources a separate entity.","solutions":["Open the metadata for the named command and add/fix its source definition (connector + operation)","Validate metadata with the CLI lint/build step to catch missing command sources early","Confirm the command name in the query matches an existing, fully-defined command","Reload metadata and retry"],"exampleFix":"// before\n{\"commands\":{\"usersByEmail\":{\"arguments\":{}}}}\n// after\n{\"commands\":{\"usersByEmail\":{\"source\":{\"dataConnector\":\"pg\",\"procedure\":\"users_by_email\"},\"arguments\":{}}}}","handlingStrategy":"validation","validationCode":"fn command_has_source(metadata: &Metadata, name: &Qualified<CommandName>) -> bool {\n    metadata.commands.get(name).map(|c| c.source.is_some()).unwrap_or(false)\n}","typeGuard":"fn is_command_source_not_found(e: &ArgumentPresetExecutionError) -> bool {\n    matches!(e, ArgumentPresetExecutionError::CommandSourceNotFound { .. })\n}","tryCatchPattern":"match result {\n    Err(PlanError::Arguments(ArgumentPresetExecutionError::CommandSourceNotFound { command_name })) => {\n        bad_request(format!(\"command {command_name} has no source\"));\n    }\n    other => other,\n}","preventionTips":["Validate command definitions in a metadata build step (source is required)","Use codegen or templates for command definitions so sources are never omitted","Fail fast at startup by resolving every declared command once"],"tags":["rust","commands","metadata","plan"],"backgroundTag":"metadata-entity-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}