{"record":{"id":"3b073915e82f7672","repo":"clockworklabs/SpacetimeDB","slug":"caller-is-not-authorized-to-run-sql-dml-stateme","errorCode":null,"errorMessage":"Caller {} is not authorized to run SQL DML statements","messagePattern":"Caller (.+?) is not authorized to run SQL DML statements","errorType":"exception","errorClass":"DBError","httpStatus":null,"severity":"error","filePath":"crates/core/src/sql/execute.rs","lineNumber":147,"sourceCode":"                Ok(plan)\n            })?;\n\n            // Update transaction metrics\n            tx.metrics.merge(metrics);\n\n            Ok((\n                SqlResult {\n                    tx_offset,\n                    rows,\n                    metrics: tx.metrics,\n                },\n                trapped,\n            ))\n        }\n        Statement::DML(stmt) => {\n            // An extra layer of auth is required for DML\n            if !auth.has_write_access() {\n                return Err(anyhow!(\"Caller {} is not authorized to run SQL DML statements\", auth.caller()).into());\n            }\n\n            // Evaluate the mutation\n            let (mut tx, _) = db.with_auto_rollback(tx, |tx| execute_dml_stmt(&auth, stmt, tx, &mut metrics))?;\n\n            // Update transaction metrics\n            tx.metrics.merge(metrics);\n\n            // Update views\n            let (result, _num_views_evaluated, trapped) = match instance {\n                Some(instance) => ModuleHost::call_views_with_tx(tx, instance, auth.caller()),\n                None => (ViewCallResult::default(tx), 0, false),\n            };\n\n            // Rollback transaction and report metrics if view execution failed\n            if let ViewOutcome::Failed(err) = result.outcome {\n                let (_, metrics, reducer) = db.rollback_mut_tx(result.tx);\n                db.report_mut_tx_metrics(reducer, metrics, None);","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/core/src/sql/execute.rs#L129-L165","documentation":"Error \"Caller {} is not authorized to run SQL DML statements\" thrown in clockworklabs/SpacetimeDB.","triggerScenarios":"Thrown at crates/core/src/sql/execute.rs:147 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}