{"record":{"id":"c4013b010bc9035c","repo":"hasura/graphql-engine","slug":"model-source-is-required-to-resolve-relational-per","errorCode":null,"errorMessage":"model source is required to resolve relational permissions","messagePattern":"model source is required to resolve relational permissions","errorType":"validation","errorClass":"ModelPermissionError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/model_permissions/error.rs","lineNumber":58,"sourceCode":"    },\n\n    #[error(\n        \"a preset argument '{argument_name}' has been set for the model '{model_name}' but no such argument exists for this model\"\n    )]\n    ModelArgumentPresetArgumentNotFound {\n        model_name: Spanned<Qualified<ModelName>>,\n        argument_name: Spanned<ArgumentName>,\n    },\n\n    #[error(\"in select filter permissions: {error}\")]\n    SelectFilterPermissionTypePredicateError { error: TypePredicateError },\n\n    #[error(\"unknown type {custom_type_name}\")]\n    UnknownType {\n        custom_type_name: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"model source is required to resolve relational permissions\")]\n    ModelSourceRequiredForRelationalPermissions,\n    #[error(\"unknown collection {collection} in data connector {data_connector}\")]\n    UnknownModelCollection {\n        data_connector: Qualified<DataConnectorName>,\n        collection: open_dds::data_connector::CollectionName,\n    },\n    #[error(\"relational insert is not supported for this model\")]\n    RelationalInsertNotSupported,\n    #[error(\"relational update is not supported for this model\")]\n    RelationalUpdateNotSupported,\n    #[error(\"relational delete is not supported for this model\")]\n    RelationalDeleteNotSupported,\n\n    #[error(\"{0}\")]\n    ModelsError(#[from] models::ModelsError),\n}\n\nimpl ContextualError for NamedModelPermissionError {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/model_permissions/error.rs#L40-L76","documentation":"Thrown by the metadata-resolve model_permissions stage when a model declares relational permissions (insert/update/delete) but the model has no source configured. Relational permissions can only be resolved against a data-connector-backed collection, so a sourceless (e.g. command-based) model cannot carry them.","triggerScenarios":"Declaring SelectInsert/SelectUpdate/SelectDelete permissions under models.permissions for a model that has no 'source' (or whose source was removed), typically in the NDH metadata YAML for a model backed only by a command.","commonSituations":"Migrating a model from a data-connector source to a command-backed model and leaving relational permissions behind; copy-pasting a permission block from a sourced model to a sourceless one.","solutions":["Remove the insert/update/delete permission entries from the model's permissions block in the metadata","Or add a valid source (data_connector + collection) to the model if relational operations are intended","Re-run metadata resolve/apply after the change"],"exampleFix":"// before\nmodels:\n  MyModel:\n    permissions:\n      - role: admin\n        insert: { ... }   # model has no source\n// after\nmodels:\n  MyModel:\n    permissions:\n      - role: admin\n        select: { ... }","handlingStrategy":"validation","validationCode":"// before applying metadata, assert every model with relational permissions has a source\nfor (name, model) in models {\n    let has_relational = model.permissions.iter().any(|p| p.insert.is_some() || p.update.is_some() || p.delete.is_some());\n    if has_relational && model.source.is_none() {\n        eprintln!(\"model {name} has relational permissions but no source\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a project lint that rejects relational permissions on sourceless models","Remove insert/update/delete blocks when converting a model to command-backed"],"tags":["hasura","ndh","metadata","permissions","models"],"backgroundTag":"metadata-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}