tursodatabase/turso · error · ArgumentException

Only input parameters are supported

Error message

Only input parameters are supported

What it means

TursoParameter.Direction only ever returns ParameterDirection.Input, and the setter throws ArgumentException for any other value (Output, InputOutput, ReturnValue). Turso's statement protocol binds values client-to-server only; it has no output-parameter mechanism, so requesting one is rejected immediately rather than silently ignored.

Source

Thrown at bindings/dotnet/src/Turso.Data/TursoParameter.cs:75

        DbType = dbType;
        Value = value;
    }

    public override void ResetDbType()
    {
        DbType = DbType.String;
    }

    public override DbType DbType { get; set; } = DbType.String;

    public override ParameterDirection Direction
    {
        get => ParameterDirection.Input;
        set
        {
            if (value != ParameterDirection.Input)
            {
                throw new ArgumentException("Only input parameters are supported");
            }
        }
    }
    public override bool IsNullable { get; set; }
    [AllowNull]
    public override string ParameterName { get; set; } = "";

    [AllowNull]
    public override string SourceColumn { get; set; } = "";
    public override object? Value { get; set; }
    public override bool SourceColumnNullMapping { get; set; }

    public TursoValue ToValue()
    {
        if (Value is null)
            return new TursoValue { ValueType = TursoValueType.Null };

        var value = Value;

View on GitHub (pinned to 6c72522679)

Solutions

  1. Remove the Direction assignment — Input is already the default.
  2. Restructure code that relied on OUT parameters: use SELECT to return values and read them with a reader (or use ExecuteScalar).
  3. If a shared helper sets Direction, gate it: only assign when the value is ParameterDirection.Input, or skip Turso commands.

Example fix

// before
var p = new TursoParameter("@newId", 0) { Direction = ParameterDirection.Output };

// after
var p = new TursoParameter("@newId", 0); // direction stays Input; read results via SELECT instead
Defensive patterns

Strategy: validation

Validate before calling

if (parameter.Direction != ParameterDirection.Input)
    throw new NotSupportedException("Turso supports input parameters only; return data via SELECT.");

Prevention

When it happens

Trigger: Setting 'parameter.Direction = ParameterDirection.Output' (or InputOutput/ReturnValue) on a TursoParameter; ORMs or generic ADO.NET helpers that set Direction on every parameter; code ported from SQL Server stored-procedure call sites.

Common situations: Migrating stored-procedure-based code that used OUTPUT parameters; Dapper/EF-style helpers that probe directions; copy-pasted command wrappers that set Direction explicitly.

Related errors


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