nopSolutions/nopCommerce · critical · Exception
DatabaseNotExists
Error message
DatabaseNotExists
What it means
Thrown during installation when the installer is NOT asked to create the database (CreateDatabaseIfNotExists false) and dataProvider.DatabaseExistsAsync() returns false — the target database does not exist, so initialization cannot proceed.
Source
Thrown at src/Presentation/Nop.Web/Controllers/InstallController.cs:243
}, _fileProvider);
if (model.CreateDatabaseIfNotExists && !await dataProvider.DatabaseExistsAsync())
{
try
{
SetProgressMessage(_locService.Value.GetResource("Progress.CreateDatabase"));
dataProvider.CreateDatabase();
}
catch (Exception ex)
{
throw new Exception(string.Format(_locService.Value.GetResource("DatabaseCreationError"), ex.Message));
}
}
else
{
//check whether database exists
if (!await dataProvider.DatabaseExistsAsync())
throw new Exception(_locService.Value.GetResource("DatabaseNotExists"));
}
SetProgressMessage(_locService.Value.GetResource("Progress.InitializeDatabase"));
dataProvider.InitializeDatabase();
var cultureInfo = new CultureInfo(NopCommonDefaults.DefaultLanguageCulture);
var regionInfo = new RegionInfo(NopCommonDefaults.DefaultLanguageCulture);
var languagePackInfo = (DownloadUrl: string.Empty, Progress: 0);
if (model.InstallRegionalResources)
{
SetProgressMessage(_locService.Value.GetResource("Progress.RegionalResources"));
//try to get CultureInfo and RegionInfo
if (model.Country != null)
{
try
{
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Tick 'Create database if not exists' on the install form so the installer provisions it, OR pre-create the empty database manually on the server.
- Verify the database name is spelled correctly and matches the connection string.
- Confirm the connecting account has access to (can see) the target database.
Defensive patterns
Strategy: validation
Validate before calling
if (!model.CreateDatabaseIfNotExists && !await dataProvider.DatabaseExistsAsync())
{
ModelState.AddModelError("", _locService.Value.GetResource("DatabaseNotExists"));
return View(model);
} Try / catch
catch (Exception exc) when (exc.Message == _locService.Value.GetResource("DatabaseNotExists"))
{
ModelState.AddModelError("Database", exc.Message);
return View(model);
} Prevention
- Pre-create the target database before installing if you cannot grant CREATE DATABASE.
- Tick 'Create database if not exists' when the account has provisioning rights.
- Double-check the database name spelling against the connection string.
When it happens
Trigger: InstallController line ~243: user did not tick 'Create database if not exists', the named database does not exist on the server, so the existence check fails.
Common situations: Admin expects the DB to already exist but it was never created or was dropped; the database name is misspelled; the wrong server instance is targeted; the account can connect but the DB is not visible (permissions/catalog visibility).
Related errors
- DatabaseCreationError
- ConnectionStringWrongFormat
- Unable to connect to the new database. Please try one more t
- Unable to connect to the new database. Please try one more t
- This database provider does not support backup
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/85a5c6bfe3ca5f51.
Report an issue: GitHub.