{"record":{"id":"138201a832df161a","repo":"babalae/better-genshin-impact","slug":"error-138201","errorCode":null,"errorMessage":"秘境任务参数不能为空","messagePattern":"秘境任务参数不能为空","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs","lineNumber":336,"sourceCode":"    }\n\n\n    public CancellationToken GetLinkedCancellationToken()\n    {\n        return GetLinkedCancellationTokenSource().Token;\n    }\n    \n    /// <summary>  \n    /// 运行自动秘境任务\n    /// </summary>  \n    /// <param name=\"param\">秘境任务参数</param>  \n    /// <param name=\"customCt\">自定义取消令牌</param>  \n    /// <returns></returns>  \n    public async Task<Dictionary<string, int>> RunAutoDomainTask(AutoDomainParam param, CancellationToken? customCt = null)\n    {  \n        if (param == null)  \n        {  \n            throw new ArgumentNullException(nameof(param), \"秘境任务参数不能为空\");  \n        }  \n  \n        CancellationToken cancellationToken = customCt ?? CancellationContext.Instance.Cts.Token;  \n        return await new AutoDomainTask(param).Start(cancellationToken);\n    }  \n\n    /// <summary>\n    /// 运行自动首领讨伐任务\n    /// </summary>\n    /// <param name=\"param\">自动首领讨伐任务参数</param>\n    /// <param name=\"customCt\">自定义取消令牌</param>\n    /// <returns></returns>\n    public async Task<Dictionary<string, int>> RunAutoBossTask(AutoBossParam param, CancellationToken? customCt = null)\n    {\n        if (param == null)\n        {\n            throw new ArgumentNullException(nameof(param), \"自动首领讨伐任务参数不能为空\");\n        }","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs#L318-L354","documentation":"ArgumentNullException thrown by RunAutoDomainTask at line 336 when the AutoDomainParam argument is null. This overload takes a fully-formed param (unlike RunTask which builds params internally), so a null param has no domain/fight strategy/settings to run with.","triggerScenarios":"JS calls `dispatcher.RunAutoDomainTask(null)`. A param-builder function returned undefined and was passed through.","commonSituations":"Author forgot to construct AutoDomainParam. Conditional construction left the variable null.","solutions":["Construct AutoDomainParam with the required domain/strategy settings before calling.","Null-check in JS before invoking.","If settings come from the UI, fetch them first rather than passing null."],"exampleFix":"// before (JS)\ndispatcher.RunAutoDomainTask(param); // param is null -> throws\n\n// after (JS)\nif (!param) { throw new Error('AutoDomainParam is required'); }\ndispatcher.RunAutoDomainTask(param);","handlingStrategy":"validation","validationCode":"// JS side\nif (!param) throw new Error('AutoDomainParam is required');\ndispatcher.RunAutoDomainTask(param);","typeGuard":"// JS\nfunction isAutoDomainParam(v) { return v != null && typeof v === 'object'; }","tryCatchPattern":null,"preventionTips":["Construct AutoDomainParam before calling RunAutoDomainTask.","Null-check params in JS wrappers.","Fetch UI settings first rather than passing null."],"tags":["script","argument-null","auto-domain","dispatcher"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}