{"record":{"id":"a8c9be3ae4f27b75","repo":"tursodatabase/turso","slug":"unknown-collection-collectionname","errorCode":null,"errorMessage":"Unknown collection: {collectionName}.","messagePattern":"Unknown collection: (.+?)\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data.Sqlite/SqliteConnection.cs","lineNumber":320,"sourceCode":"\n        if (string.Equals(collectionName, DbMetaDataCollectionNames.ReservedWords, StringComparison.OrdinalIgnoreCase))\n        {\n            ValidateRestrictions(collectionName, restrictionValues, 0);\n            var table = new DataTable(DbMetaDataCollectionNames.ReservedWords);\n            table.Columns.Add(DbMetaDataColumnNames.ReservedWord, typeof(string));\n            foreach (var word in new[] { \"ABORT\", \"ALTER\", \"CREATE\", \"DELETE\", \"DROP\", \"INSERT\", \"SELECT\", \"UPDATE\" })\n                table.Rows.Add(word);\n\n            return table;\n        }\n\n        if (string.Equals(collectionName, \"Tables\", StringComparison.OrdinalIgnoreCase))\n            return GetTablesSchema(collectionName, restrictionValues);\n\n        if (string.Equals(collectionName, \"Columns\", StringComparison.OrdinalIgnoreCase))\n            return GetColumnsSchema(collectionName, restrictionValues);\n\n        throw new ArgumentException(Properties.Resources.UnknownCollection(collectionName));\n    }\n\n    public static void ClearAllPools()\n    {\n    }\n\n    public static void ClearPool(SqliteConnection connection)\n    {\n        ArgumentNullException.ThrowIfNull(connection);\n    }\n\n    public new virtual SqliteTransaction BeginTransaction()\n        => BeginTransaction(IsolationLevel.Unspecified);\n\n    public virtual SqliteTransaction BeginTransaction(bool deferred)\n        => BeginTransaction(IsolationLevel.Unspecified, deferred);\n\n    public new virtual SqliteTransaction BeginTransaction(IsolationLevel isolationLevel)","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/tursodatabase/turso/blob/6c7252267988c76e632af00a671e4b9788dfae13/bindings/dotnet/src/Turso.Data.Sqlite/SqliteConnection.cs#L302-L338","documentation":"GetSchema(collectionName) only recognizes a fixed set of metadata collections: MetaDataCollections, ReservedWords, Tables, and Columns (DataSourceInformation and DataTypes are not implemented in this provider, unlike Microsoft.Data.Sqlite). Any other collectionName throws ArgumentException. The MetaDataCollections table returned by GetSchema() lists exactly what is supported, including the number of restrictions per collection (Tables and Columns: 4; the rest: 0).","triggerScenarios":"conn.GetSchema(\"Indexes\"), GetSchema(\"ForeignKeys\"), GetSchema(\"Views\"), or GetSchema(\"DataSourceInformation\"); generic schema-exploration tools (e.g. DataSet designers, SSDL generators, DB tooling) enumerating standard DbMetaDataCollectionNames; code ported from Microsoft.Data.Sqlite or System.Data.SqlClient expecting the full collection set.","commonSituations":"ORM/tooling compatibility layers that request standard collections, visual designers inspecting databases, and shared helpers written against richer providers.","solutions":["Call GetSchema() (no arguments) first and read the returned collection names; request only collections in that list.","For metadata not exposed (indexes, FKs, views, triggers), query SQLite's catalog directly: 'SELECT * FROM sqlite_master' and PRAGMA statements (index_list, foreign_key_list).","Wrap GetSchema in a helper that catches ArgumentException and falls back to sqlite_master queries."],"exampleFix":"// before\nvar tbl = conn.GetSchema(\"ForeignKeys\"); // throws: Unknown collection: ForeignKeys\n\n// after\nvar tbl = conn.GetSchema(\"Tables\"); // supported: MetaDataCollections, ReservedWords, Tables, Columns\n// for anything else, use the catalog:\nusing var cmd = conn.CreateCommand();\ncmd.CommandText = \"SELECT name, sql FROM sqlite_master WHERE type = 'table'\";","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> SupportedCollections = new(StringComparer.OrdinalIgnoreCase)\n{ \"MetaDataCollections\", \"ReservedWords\", \"Tables\", \"Columns\" };\n\nstatic DataTable SafeGetSchema(SqliteConnection conn, string collection, string?[]? restrictions = null)\n{\n    if (!SupportedCollections.Contains(collection))\n        throw new ArgumentOutOfRangeException(nameof(collection), $\"{collection} not supported; query sqlite_master instead.\");\n    return conn.GetSchema(collection, restrictions);\n}","typeGuard":"static bool IsSupportedSchemaCollection(string name) =>\n    name.Equals(\"MetaDataCollections\", StringComparison.OrdinalIgnoreCase)\n    || name.Equals(\"ReservedWords\", StringComparison.OrdinalIgnoreCase)\n    || name.Equals(\"Tables\", StringComparison.OrdinalIgnoreCase)\n    || name.Equals(\"Columns\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"null","preventionTips":["Enumerate GetSchema().Rows once at startup and cache the supported collection names.","Route unsupported metadata needs to sqlite_master and PRAGMA queries (index_list, foreign_key_list).","Do not assume Microsoft.Data.Sqlite's collection set transfers to this provider."],"tags":["ado-net","sqlite","turso","schema","metadata"],"backgroundTag":"unsupported-schema-collection","analyzedSha":"6c7252267988c76e632af00a671e4b9788dfae13","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}