{"record":{"id":"bab0eb5a458dbbc4","repo":"tursodatabase/turso","slug":"no-data-exists-for-the-row-column","errorCode":null,"errorMessage":"No data exists for the row/column.","messagePattern":"No data exists for the row/column\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data.Sqlite/SqliteDataReader.cs","lineNumber":434,"sourceCode":"        schema.Columns.Add(SchemaTableColumn.IsLong, typeof(bool));\n        schema.Columns.Add(SchemaTableColumn.ProviderType, typeof(int));\n\n        var tableName = TryGetSelectSource(out var parsedTableName, out var selections) ? parsedTableName : null;\n        var tableColumns = tableName is null ? new Dictionary<string, SchemaColumnInfo>(StringComparer.OrdinalIgnoreCase) : GetTableColumns(tableName);\n\n        for (var i = 0; i < FieldCount; i++)\n        {\n            var columnName = GetName(i);\n            var selection = i < selections.Count ? selections[i] : columnName;\n            var baseColumnName = ResolveBaseColumnName(selection, columnName, tableColumns);\n            SchemaColumnInfo? columnInfo = null;\n            var hasBaseColumn = baseColumnName is not null && tableName is not null && tableColumns.TryGetValue(baseColumnName, out columnInfo);\n            var valueType = TursoBindings.GetValue(statement, i).ValueType;\n            if (valueType is TursoValueType.Empty or TursoValueType.Null)\n                valueType = GetSampleValueType(i);\n\n            var info = hasBaseColumn\n                ? columnInfo ?? throw new InvalidOperationException(Properties.Resources.NoData)\n                : null;\n            var dataTypeName = info is not null\n                ? StripTypeLength(info.TypeName)\n                : GetDataTypeNameFromValueType(valueType, selection);\n            var dataType = info is not null\n                ? GetClrTypeFromSqliteType(info.TypeName, valueType)\n                : GetClrTypeFromValueType(valueType);\n            var isExpression = info is null;\n            var row = schema.NewRow();\n            row[SchemaTableColumn.ColumnName] = columnName;\n            row[SchemaTableColumn.ColumnOrdinal] = i;\n            row[SchemaTableColumn.ColumnSize] = -1;\n            row[SchemaTableColumn.NumericPrecision] = DBNull.Value;\n            row[SchemaTableColumn.NumericScale] = DBNull.Value;\n            row[SchemaTableColumn.IsUnique] = info is not null ? info.IsUnique : DBNull.Value;\n            row[SchemaTableColumn.IsKey] = info is not null ? info.IsKey : DBNull.Value;\n            row[\"BaseServerName\"] = \"\";\n            row[\"BaseCatalogName\"] = info is not null ? \"main\" : DBNull.Value;","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/dotnet/src/Turso.Data.Sqlite/SqliteDataReader.cs#L416-L452","documentation":"InvalidOperationException ('No data exists for the row/column.') thrown inside GetSchemaTable when a result column resolves to a base table column (baseColumnName and tableName are known and the table's column dictionary reports the column) but the looked-up SchemaColumnInfo is null — a defensive guard against metadata-table inconsistency. In practice this path is nearly unreachable: TryGetValue returning true always yields a non-null info record. If you hit it, the statement's schema metadata (PRAGMA table_info-derived) disagreed with the result-set shape, e.g. for views, CTEs, or DDL raced concurrently.","triggerScenarios":"Calling GetSchemaTable() on a reader whose statement introspects a table that was altered/dropped concurrently; exotic projections over views or CTEs where base-column resolution partially succeeds; this is a guard for internal state disagreement, not a user input error.","commonSituations":"Migration tools that read schema while another connection alters the same table; schema-introspection utilities calling GetSchemaTable on arbitrary user queries; almost never seen in normal CRUD code.","solutions":["Prefer reader.GetColumnSchema() (DbColumn list) for per-column metadata — it does not depend on base-table resolution.","Avoid running GetSchemaTable while another connection mutates the schema; snapshot the schema first.","If reproducible on a stable schema, capture the exact SQL and report it as a binding bug."],"exampleFix":"// before\nvar table = reader.GetSchemaTable(); // throws on metadata disagreement\n\n// after\nvar columns = reader.GetColumnSchema(); // lighter, no base-table resolution\nforeach (var c in columns) Console.WriteLine($\"{c.ColumnName} {c.DataTypeName}\");","handlingStrategy":"fallback","validationCode":"if (reader.FieldCount == 0) throw new InvalidOperationException(\"Statement has no columns; skip GetSchemaTable.\");","typeGuard":null,"tryCatchPattern":"try { schema = reader.GetSchemaTable(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No data\"))\n{ schema = null; /* fall back to GetColumnSchema() below */ }\nvar cols = schema?.Rows.Cast<DataRow>() ?? reader.GetColumnSchema().Select(c => new { c.ColumnName, c.DataTypeName }).Cast<dynamic>();","preventionTips":["Prefer GetColumnSchema() for per-column metadata.","Do not introspect schema while concurrent connections run migrations."],"tags":["csharp","dotnet","sqlite","data-reader","schema-metadata"],"backgroundTag":"schema-metadata-mismatch","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}