clockworklabs/SpacetimeDB · error · DBError

Caller {} is not authorized to run SQL DML statements

Error message

Caller {} is not authorized to run SQL DML statements

What it means

Error "Caller {} is not authorized to run SQL DML statements" thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/core/src/sql/execute.rs:147

                Ok(plan)
            })?;

            // Update transaction metrics
            tx.metrics.merge(metrics);

            Ok((
                SqlResult {
                    tx_offset,
                    rows,
                    metrics: tx.metrics,
                },
                trapped,
            ))
        }
        Statement::DML(stmt) => {
            // An extra layer of auth is required for DML
            if !auth.has_write_access() {
                return Err(anyhow!("Caller {} is not authorized to run SQL DML statements", auth.caller()).into());
            }

            // Evaluate the mutation
            let (mut tx, _) = db.with_auto_rollback(tx, |tx| execute_dml_stmt(&auth, stmt, tx, &mut metrics))?;

            // Update transaction metrics
            tx.metrics.merge(metrics);

            // Update views
            let (result, _num_views_evaluated, trapped) = match instance {
                Some(instance) => ModuleHost::call_views_with_tx(tx, instance, auth.caller()),
                None => (ViewCallResult::default(tx), 0, false),
            };

            // Rollback transaction and report metrics if view execution failed
            if let ViewOutcome::Failed(err) = result.outcome {
                let (_, metrics, reducer) = db.rollback_mut_tx(result.tx);
                db.report_mut_tx_metrics(reducer, metrics, None);

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/core/src/sql/execute.rs:147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/3b073915e82f7672. Report an issue: GitHub.