microsoft/aspire · error

Embedded dashboard database schema script

Error message

Embedded dashboard database schema script '{resourceName}' was not found.

What it means

The dashboard's embedded SQLite database schema is loaded from resources embedded in the Aspire.Dashboard assembly. LoadSchemaScripts reads each expected embedded manifest resource stream by name; if the assembly does not contain a script with that name, it throws this InvalidOperationException. This almost always indicates a build or packaging problem rather than a caller mistake.

Solutions

  1. Rebuild the Aspire.Dashboard package/assembly from a clean state so schema scripts are embedded again
  2. Verify the dashboard assemblies are all from the same Aspire version and were not trimmed or altered
  3. Check that schema .sql files remain marked as EmbeddedResource in the Aspire.Dashboard project
  4. If you hit this consistently, file an issue against Aspire with the resource name and assembly version
Defensive patterns

Strategy: try-catch

Validate before calling

var names = assembly.GetManifestResourceNames();
if (!names.Contains(resourceName))
{
    throw new InvalidOperationException($"Schema script '{resourceName}' missing from {assembly.FullName}");
}

Try / catch

try { var scripts = LoadSchemaScripts(assembly, resourceNames); }
catch (InvalidOperationException ex)
{
    logger.LogError(ex, "Embedded dashboard schema missing; assembly may be corrupt or mismatched");
}

Prevention

When it happens

Trigger: An assembly.GetManifestResourceStream(resourceName) call returns null because the .sql schema files were not embedded (missing EmbeddedResource entries), the assembly was repackaged/trimmed, or a version mismatch leaves the resource name expected by the code absent from the loaded assembly.

Common situations: Running a partially-built or modified Aspire.Dashboard assembly, custom builds that strip embedded resources, loading the dashboard types from a mismatched assembly version, or resource-name refactors that did not update the resource list.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/c9cfc67258bdd4be. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Dashboard/ServiceClient/DashboardSqliteDatabase.cs:207

    private static IReadOnlyList<string> LoadSchemaScripts()
    {
        var assembly = typeof(DashboardSqliteDatabase).Assembly;
        // Numeric filename prefixes define execution order because later schema domains reference tables created by earlier scripts.
        var resourceNames = assembly.GetManifestResourceNames()
            .Where(name => name.StartsWith(SchemaResourcePrefix, StringComparison.Ordinal) && name.EndsWith(".sql", StringComparison.Ordinal))
            .Order(StringComparer.Ordinal)
            .ToArray();

        if (resourceNames.Length == 0)
        {
            throw new InvalidOperationException("No embedded dashboard database schema scripts were found.");
        }

        var scripts = new List<string>(resourceNames.Length);
        foreach (var resourceName in resourceNames)
        {
            using var stream = assembly.GetManifestResourceStream(resourceName)
                ?? throw new InvalidOperationException($"Embedded dashboard database schema script '{resourceName}' was not found.");
            using var reader = new StreamReader(stream);
            scripts.Add(reader.ReadToEnd());
        }

        return scripts;
    }

    private static bool ValidateSchemaVersion(SqliteConnection connection, IDbTransaction? transaction, int expectedVersion)
    {
        // Opening the database and setting WAL creates a valid SQLite file before the schema transaction
        // commits, so an interrupted first initialization leaves a file with no dashboard_schema table.
        // Querying it directly throws "no such table: dashboard_schema", and because Resume only replaces
        // the database when this returns false, every later start would keep crashing.
        //
        // Probe sqlite_master first so a missing schema table reports "not compatible" while genuine IO,
        // locking, and corruption failures still surface as exceptions.
        // See https://www.sqlite.org/schematab.html
        var schemaTableCount = connection.QuerySingle<long>("""

View on GitHub (pinned to 25830f84bd)