{"record":{"id":"17162fa9a6f42f26","repo":"egametang/ET","slug":"error-17162f","errorCode":null,"errorMessage":"命令行格式错误! {error}","messagePattern":"命令行格式错误! (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"Packages/cn.etetet.loader/Scripts/Loader/Client/Init.cs","lineNumber":27,"sourceCode":"        private void Start()\n        {\n            this.StartAsync().Coroutine();\n        }\n\t\t\n        private async ETTask StartAsync()\n        {\n            DontDestroyOnLoad(gameObject);\n\t\t\t\n            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>\n            {\n                Log.Error(e.ExceptionObject.ToString());\n            };\n\n            GlobalConfig globalConfig = Resources.Load<GlobalConfig>(\"GlobalConfig\");\n            // 命令行参数\n            string[] args = { $\"--SceneName={globalConfig.SceneName}\" };\n            Parser.Default.ParseArguments<Options>(args)\n                    .WithNotParsed(error => throw new Exception($\"命令行格式错误! {error}\"))\n                    .WithParsed((o)=>World.Instance.AddSingleton(o));\n\n\n            \n            // 编辑器模式下如果开启了ENABLE_VIEW使用单线程，WEBGL模式也使用单线程\n#if (ENABLE_VIEW && UNITY_EDITOR) || UNITY_WEBGL\n            Options.Instance.SingleThread = 1;\n#endif\n            \n            World.Instance.AddSingleton<Logger>().Log = new UnityLogger(\"None\");\n            ETTask.ExceptionHandler += Log.Error;\n\t\t\t\n            World.Instance.AddSingleton<TimeInfo>();\n            World.Instance.AddSingleton<FiberManager>();\n\n            await World.Instance.AddSingleton<ResourcesComponent>().CreatePackageAsync(\"DefaultPackage\", true);\n            \n            World.Instance.AddSingleton<CodeLoader>().Start().Coroutine();","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.loader/Scripts/Loader/Client/Init.cs#L9-L45","documentation":"Thrown inside the Unity client Init MonoBehaviour (Scripts/Loader/Client/Init.cs) when CommandLineParser fails to parse the synthetic args array built from GlobalConfig.SceneName. Unlike the server entry (207), these args are constructed in-code as { $\"--SceneName={globalConfig.SceneName}\" }, so a parse failure almost always means GlobalConfig.SceneName is malformed or GlobalConfig itself failed to load.","triggerScenarios":"Resources.Load<GlobalConfig>(\"GlobalConfig\") returns null (asset missing) and globalConfig.SceneName dereference NPEs, OR SceneName contains characters that break the --SceneName= token (spaces/quotes handled oddly). WithNotParsed then throws.","commonSituations":"GlobalConfig.asset not present in a Resources folder after a build; SceneName field left empty or set to an invalid value in the inspector; a rename of the scene without updating the GlobalConfig.","solutions":["Verify GlobalConfig.asset exists under a Resources/ folder and its SceneName is a valid, non-empty value.","Null-check the Resources.Load result before using globalConfig and log a clear error.","Ensure SceneName matches an actual configured scene name expected by Options."],"exampleFix":"// before\nGlobalConfig globalConfig = Resources.Load<GlobalConfig>(\"GlobalConfig\");\nstring[] args = { $\"--SceneName={globalConfig.SceneName}\" };\n\n// after\nGlobalConfig globalConfig = Resources.Load<GlobalConfig>(\"GlobalConfig\");\nif (globalConfig == null || string.IsNullOrEmpty(globalConfig.SceneName))\n    throw new Exception(\"GlobalConfig missing or SceneName empty\");\nstring[] args = { $\"--SceneName={globalConfig.SceneName}\" };","handlingStrategy":"validation","validationCode":"GlobalConfig globalConfig = Resources.Load<GlobalConfig>(\"GlobalConfig\");\nif (globalConfig == null || string.IsNullOrEmpty(globalConfig.SceneName))\n{\n    Log.Error(\"GlobalConfig missing or SceneName empty\");\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always null-check Resources.Load results.","Keep GlobalConfig.asset in a Resources/ folder and validate it in a build step.","Ensure SceneName matches a real configured scene."],"tags":["loader","client","unity","commandline","bootstrap","globalconfig"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}