{"record":{"id":"0fcbba101387359b","repo":"microsoft/aspire","slug":"dashboard-database-for-run-run-runid-does-not-match-run","errorCode":null,"errorMessage":"Dashboard database for run '{run.RunId}' does not match run metadata schema version '{run.SchemaVersion}'.","messagePattern":"Dashboard database for run '(.+?)' does not match run metadata schema version '(.+?)'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Aspire.Dashboard/ServiceClient/DashboardDataSourcePool.cs","lineNumber":110,"sourceCode":"                    database = new DashboardSqliteDatabase(databasePath, readOnly: true);\n                    entry = new Entry(database, runLease);\n                    _entries.Add(databasePath, entry);\n                }\n                catch\n                {\n                    database?.ClearPool();\n                    database?.Dispose();\n                    runLease.Dispose();\n                    throw;\n                }\n            }\n\n            entry.ReferenceCount++;\n            try\n            {\n                if (!entry.Database.ValidateSchemaVersion(run.SchemaVersion))\n                {\n                    throw new InvalidOperationException(\n                        $\"Dashboard database for run '{run.RunId}' does not match run metadata schema version '{run.SchemaVersion}'.\");\n                }\n            }\n            catch\n            {\n                Release(entry);\n                throw;\n            }\n\n            var lease = new Lease(\n                entry.Database,\n                () => _repositoryFactory.CreateTelemetryRepository(entry.Database),\n                () => _repositoryFactory.CreateResourceRepository(entry.Database),\n                () => Release(entry));\n            try\n            {\n                _ = lease.TelemetryRepository;\n                _ = lease.ResourceRepository;","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Dashboard/ServiceClient/DashboardDataSourcePool.cs#L92-L128","documentation":"DashboardDataSourcePool validates, at acquisition time, that a pooled run's SQLite database matches the schema version recorded in the run metadata. TryAcquire throws InvalidOperationException when entry.Database.ValidateSchemaVersion(run.SchemaVersion) fails, then releases the entry — meaning the persisted database on disk was written by a different dashboard schema version than the metadata claims.","triggerScenarios":"Acquiring a data source for a historical run whose on-disk database schema version differs from the run.json SchemaVersion, e.g. after a dashboard upgrade opened an old run's database.","commonSituations":"Upgrading the Aspire dashboard and resuming/inspecting runs created by an older version; a run directory whose run.json was hand-edited or partially copied, leaving database and metadata out of sync.","solutions":["Delete or archive the incompatible historical run directory so the stale database is not reused","Regenerate/re-initialize the run's database with the current schema version, or let the dashboard recreate it","Ensure run.json metadata and the database come from the same dashboard version — never copy them across versions"],"exampleFix":"// before: resuming a run directory written by an older dashboard\n// after: remove stale run data so a compatible database is recreated\nDirectory.Delete(Path.Combine(runsDirectory, runId), recursive: true);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var source = pool.TryAcquire(run);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"does not match run metadata schema version\"))\n{\n    // discard/archive the stale run directory and refresh the run list\n}","preventionTips":["Delete or archive run directories created by older dashboard versions before resuming","Never copy run.json or database files between dashboard versions","After upgrading, review historical runs for compatibility before use"],"tags":["dashboard","schema-version","sqlite","persistence"],"backgroundTag":"schema-validation-failed","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}