{"record":{"id":"85a5c6bfe3ca5f51","repo":"nopSolutions/nopCommerce","slug":"databasenotexists","errorCode":null,"errorMessage":"DatabaseNotExists","messagePattern":"DatabaseNotExists","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/Presentation/Nop.Web/Controllers/InstallController.cs","lineNumber":243,"sourceCode":"            }, _fileProvider);\r\n\r\n            if (model.CreateDatabaseIfNotExists && !await dataProvider.DatabaseExistsAsync())\r\n            {\r\n                try\r\n                {\r\n                    SetProgressMessage(_locService.Value.GetResource(\"Progress.CreateDatabase\"));\r\n                    dataProvider.CreateDatabase();\r\n                }\r\n                catch (Exception ex)\r\n                {\r\n                    throw new Exception(string.Format(_locService.Value.GetResource(\"DatabaseCreationError\"), ex.Message));\r\n                }\r\n            }\r\n            else\r\n            {\r\n                //check whether database exists\r\n                if (!await dataProvider.DatabaseExistsAsync())\r\n                    throw new Exception(_locService.Value.GetResource(\"DatabaseNotExists\"));\r\n            }\r\n\r\n            SetProgressMessage(_locService.Value.GetResource(\"Progress.InitializeDatabase\"));\r\n            dataProvider.InitializeDatabase();\r\n\r\n            var cultureInfo = new CultureInfo(NopCommonDefaults.DefaultLanguageCulture);\r\n            var regionInfo = new RegionInfo(NopCommonDefaults.DefaultLanguageCulture);\r\n\r\n            var languagePackInfo = (DownloadUrl: string.Empty, Progress: 0);\r\n            if (model.InstallRegionalResources)\r\n            {\r\n                SetProgressMessage(_locService.Value.GetResource(\"Progress.RegionalResources\"));\r\n\r\n                //try to get CultureInfo and RegionInfo\r\n                if (model.Country != null)\r\n                {\r\n                    try\r\n                    {\r","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Controllers/InstallController.cs#L225-L261","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!model.CreateDatabaseIfNotExists && !await dataProvider.DatabaseExistsAsync())\n{\n    ModelState.AddModelError(\"\", _locService.Value.GetResource(\"DatabaseNotExists\"));\n    return View(model);\n}","typeGuard":null,"tryCatchPattern":"catch (Exception exc) when (exc.Message == _locService.Value.GetResource(\"DatabaseNotExists\"))\n{\n    ModelState.AddModelError(\"Database\", exc.Message);\n    return View(model);\n}","preventionTips":["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."],"tags":["nopcommerce","install","database","provisioning"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}