{"record":{"id":"7e8c9aa47d02434c","repo":"egametang/ET","slug":"zone-zone-not-found-mongo-connect-string","errorCode":null,"errorMessage":"zone: {zone} not found mongo connect string","messagePattern":"zone: (.+?) not found mongo connect string","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"Packages/cn.etetet.db/Scripts/Hotfix/Server/DBManagerComponentSystem.cs","lineNumber":59,"sourceCode":"            }\n\n            MongoClient mongoClient = new(startZoneConfig.DBConnection);\n            await mongoClient.DropDatabaseAsync(dbName);\n            await ETTask.CompletedTask;\n        }\n        \n        public static DBComponent GetZoneDB(this DBManagerComponent self, int zone)\n        {\n            DBComponent dbComponent = self.GetChild<DBComponent>(zone);\n            if (dbComponent != null)\n            {\n                return dbComponent;\n            }\n\n            StartZoneConfig startZoneConfig = self.GetStartZoneConfig(zone);\n            if (string.IsNullOrEmpty(startZoneConfig.DBConnection))\n            {\n                throw new Exception($\"zone: {zone} not found mongo connect string\");\n            }\n\n            string dbName = self.GetZoneDBName(zone);\n            if (string.IsNullOrEmpty(dbName))\n            {\n                throw new Exception($\"zone: {zone} not found mongo db name\");\n            }\n\n            dbComponent = self.AddChildWithId<DBComponent, string, string>(zone, startZoneConfig.DBConnection, dbName);\n            return dbComponent;\n        }\n    }\n}\n","sourceCodeStart":41,"sourceCodeEnd":73,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.db/Scripts/Hotfix/Server/DBManagerComponentSystem.cs#L41-L73","documentation":"GetZoneDB (line 59) throws when StartZoneConfig.DBConnection for the requested zone is null/empty. This means the zone configuration (StartZoneConfigCategory) has no MongoDB connection string for that zone, so no DBComponent can be created and any persistence for the zone is impossible.","triggerScenarios":"Requesting dbManager.GetZoneDB(zone) for a zone whose StartZoneConfig row omits/blank DBConnection, a zone id not present in the start config, or a config table that was not loaded before the DB call.","commonSituations":"Bringing up a new zone without configuring its DB, config generation (Luban) dropping the DBConnection column, pointing at the wrong StartConfig folder/variant, or a zone id mismatch between caller and config.","solutions":["Set DBConnection on the StartZoneConfig row for the zone (in the active StartConfig variant) to a valid mongodb:// connection string.","Confirm the zone id matches a row in StartZoneConfigCategory and that the config was loaded.","Re-run Luban config export and verify DBConnection is populated for all zones that need persistence.","Verify the correct StartConfig variant (Localhost/Moba/Mmo/Release) is active for this environment."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"StartZoneConfig cfg = configCategory.Get(zone);\nif (string.IsNullOrEmpty(cfg?.DBConnection)) throw new InvalidOperationException($\"zone {zone} missing DBConnection - check StartConfig\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure DBConnection for every zone that needs persistence.","Validate StartConfig after Luban export.","Use the correct config variant per environment."],"tags":["database","mongodb","config","startup"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}