{"record":{"id":"41dc2efb46cab7cb","repo":"hasura/graphql-engine","slug":"model-source-not-found-for-model-model-name","errorCode":null,"errorMessage":"Model source not found for model '{model_name}'","messagePattern":"Model source not found for model '(.+?)'","errorType":"error_code","errorClass":"ArgumentPresetExecutionError","httpStatus":null,"severity":"error","filePath":"v3/crates/plan/src/query/arguments.rs","lineNumber":378,"sourceCode":"        expected_type: QualifiedTypeReference,\n    },\n    #[error(\"expected {expected_type} but got a string\")]\n    GotString {\n        expected_type: QualifiedTypeReference,\n    },\n    #[error(\"expected {expected_type} but got an object\")]\n    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}\")]","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plan/src/query/arguments.rs#L360-L396","documentation":"Thrown when the planner resolves argument presets for a model but cannot find any data source (model source) registered under the requested model name. It is part of ArgumentPresetExecutionError in the plan crate and indicates the model exists in name only, with no backing source in the metadata/catalog. The Qualified<ModelName> in the variant names exactly which model failed resolution.","triggerScenarios":"Planning a query that references a model (e.g. selecting from it or using it as a command target) when the model's source is absent from the resolved metadata — typically because the model was renamed, its source was removed, or the metadata was built from a stale subset.","commonSituations":"Renaming a model in metadata without updating NDC configuration; a data connector source not being attached to the model; version upgrades where model-source linking moved from implicit to explicit; partial metadata loads that skip the sources section.","solutions":["Verify the model exists in the current metadata and has a source configured (check the model -> source relationship in your metadata file)","Confirm the Qualified<ModelName> (subgraph + name) in the failing query matches the qualified name in metadata exactly","Rebuild/reload metadata so the planner sees the model source binding","If the source was removed intentionally, update or remove queries referencing that model"],"exampleFix":"// before (metadata)\n{ \"models\": { \"users\": { \"relationships\": {} } } }\n// after\n{ \"models\": { \"users\": { \"source\": { \"dataConnector\": \"pg\", \"collection\": \"users\" } } } }","handlingStrategy":"validation","validationCode":"// Before planning, confirm the model has a source in resolved metadata\nfn model_has_source(metadata: &Metadata, name: &Qualified<ModelName>) -> bool {\n    metadata.models.get(name).map(|m| m.source.is_some()).unwrap_or(false)\n}","typeGuard":"fn is_model_source_not_found(e: &ArgumentPresetExecutionError) -> bool {\n    matches!(e, ArgumentPresetExecutionError::ModelSourceNotFound { .. })\n}","tryCatchPattern":"// In Rust, prefer matching the variant rather than catching:\nmatch result {\n    Err(PlanError::Arguments(e @ ArgumentPresetExecutionError::ModelSourceNotFound { model_name })) => {\n        return bad_request(format!(\"unknown model source: {model_name}\"));\n    }\n    other => other,\n}","preventionTips":["Run metadata validation/lint before starting the planner","Keep model names in a shared constant module so client and metadata cannot drift","Add integration tests that plan a representative query per model per role"],"tags":["rust","metadata","model-resolution","plan"],"backgroundTag":"metadata-entity-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}