{"record":{"id":"f527dea45db76ef9","repo":"egametang/ET","slug":"process-is-too-large-options-instance-process","errorCode":null,"errorMessage":"Process is too large: {Options.Instance.Process}","messagePattern":"Process is too large: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"Packages/cn.etetet.core/Scripts/Core/Share/World/IdGenerater/IdGenerater.cs","lineNumber":109,"sourceCode":"                        ++this.second; // 借用下一秒的id\n                        this.value = 0;\n                    }\n                }\n                s = this.second;\n                v = this.value;\n            }\n\n            IdStruct idStruct = new(s, this.GetProcessReplicaIndex(), v);\n            return idStruct.ToLong();\n        }\n\n        public ushort GetProcessReplicaIndex()\n        {\n            // 因为改成了服务发现，支持一个进程多个副本，比如gate只需要配一个进程，可以支持多个,同一个Replica是同一个进程Id\n            // 需要预留出来Replica数量的进程Id\n            if (Options.Instance.Process > 50000)\n            {\n                throw new Exception($\"Process is too large: {Options.Instance.Process}\");\n            }\n            return (ushort)(Options.Instance.Process + Options.Instance.ReplicaIndex);\n        }\n    }\n}\n","sourceCodeStart":91,"sourceCodeEnd":115,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.core/Scripts/Core/Share/World/IdGenerater/IdGenerater.cs#L91-L115","documentation":"GetProcessReplicaIndex (line 109) throws when Options.Instance.Process > 50000. ID generation packs Process + ReplicaIndex into a 16-bit ushort; the guard leaves headroom so Process + ReplicaIndex stays within ushort range. A Process value above 50000 would overflow when combined with ReplicaIndex.","triggerScenarios":"Starting the process with --Process (or the configured process id) greater than 50000, or a misconfigured StartProcessConfig id that exceeds the limit.","commonSituations":"Copy-paste error in process config with a too-large process id, auto-generation of process ids overflowing, env/launch args with a stray large number, misunderstanding that Process must be <= 50000 to reserve replica headroom.","solutions":["Set Options.Process (the process id from StartProcessConfig) to a value <= 50000.","Check launch args / StartProcessConfig for the offending id and correct it.","Ensure process ids are allocated from a small contiguous range and never exceed 50000.","If you genuinely need more processes, revisit the ID layout (the ushort process field is a hard ceiling)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (Options.Instance.Process > 50000 || Options.Instance.Process < 0)\n    throw new InvalidOperationException($\"Process id must be <= 50000, got {Options.Instance.Process}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep process ids in a small range (<= 50000) to leave replica headroom.","Validate Options.Process at startup before any GenerateId call.","Avoid auto-incrementing process ids past the ceiling."],"tags":["id-generation","config","startup","process"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}