tursodatabase/turso · error · ArgumentException

Command type {commandType} is not supported.

Error message

Command type {commandType} is not supported.

What it means

The provider executes SQL text only: CommandType is fixed to Text, and setting StoredProcedure or TableDirect throws ArgumentException (Properties.Resources.InvalidCommandType). SQLite's engine has no stored-procedure or table-direct execution mode, so the setter rejects unsupported values eagerly instead of failing at prepare time.

Source

Thrown at bindings/dotnet/src/Turso.Data.Sqlite/SqliteCommand.cs:82

    }

    public override int CommandTimeout
    {
        get => _commandTimeout;
        set
        {
            ArgumentOutOfRangeException.ThrowIfNegative(value);
            _commandTimeout = value;
        }
    }

    public override CommandType CommandType
    {
        get => CommandType.Text;
        set
        {
            if (value != CommandType.Text)
                throw new ArgumentException(Properties.Resources.InvalidCommandType(value));
        }
    }

    public override bool DesignTimeVisible { get; set; }

    public override UpdateRowSource UpdatedRowSource { get; set; }

    public new SqliteConnection? Connection
    {
        get => _connection;
        set
        {
            ThrowIfReaderOpen(nameof(Connection));
            _connection = value;
            if (value is not null)
            {
                _commandTimeout = value.DefaultTimeout;
                _transaction ??= value.Transaction;

View on GitHub (pinned to 6c72522679)

Solutions

  1. Remove the CommandType assignment - Text is the default and the only valid value.
  2. Replace stored-procedure calls with the equivalent inline SQL statements (SQLite has no sprocs).
  3. In cross-provider code, gate any CommandType assignment on the provider's capabilities.

Example fix

// before
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_GetUser"; // throws: StoredProcedure not supported

// after
cmd.CommandType = CommandType.Text; // default; may be omitted
cmd.CommandText = "SELECT id, name FROM users WHERE id = $id";
Defensive patterns

Strategy: validation

Validate before calling

if (configuredType != CommandType.Text)
    throw new NotSupportedException("SQLite provider supports CommandType.Text only");

cmd.CommandText = sql; // leave CommandType at its default

Prevention

When it happens

Trigger: Ported System.Data code that sets cmd.CommandType = CommandType.StoredProcedure; ORMs/query builders that set CommandType from configuration; copy-paste from SQL Server or Oracle examples.

Common situations: Migrating ADO.NET codebases to SQLite; shared provider code branching on CommandType; tooling that auto-sets CommandType for command text starting with 'exec' or an object name.

Related errors


AI-assisted analysis of tursodatabase/turso@6c72522679 (2026-08-20). Data as JSON: /api/errors/4d779826a11a3aed. Report an issue: GitHub.