{"record":{"id":"eb24e67fe94e36ab","repo":"babalae/better-genshin-impact","slug":"gridscreenname","errorCode":null,"errorMessage":"gridScreenName为空或错误","messagePattern":"gridScreenName为空或错误","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs","lineNumber":283,"sourceCode":"                        }\n                    }\n\n                    var autoEatConfig = TaskContext.Instance().Config.AutoEatConfig;\n                    return await new AutoEatTask(new AutoEatParam()\n                    {\n                        CheckInterval = autoEatConfig.CheckInterval,\n                        EatInterval = autoEatConfig.EatInterval,\n                        ShowNotification = autoEatConfig.ShowNotification,\n                        FoodName = foodName\n                    }).Start(cancellationToken);\n                }\n            case \"CountInventoryItem\":\n                {\n                    if (soloTask.Config == null)\n                    {\n                        throw new NullReferenceException($\"{nameof(soloTask.Config)}为空\");\n                    }\n                    GridScreenName gridScreenName = ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, \"gridScreenName\", (GridScreenName?)null) ?? throw new Exception(\"gridScreenName为空或错误\");\n                    string? itemName = ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, \"itemName\", (string?)null);\n                    IEnumerable<string>? itemNames = ScriptObjectConverter.GetValue<string>((ScriptObject)soloTask.Config, \"itemNames\");\n                    CountInventoryItemParam param = new()\n                    {\n                        GridScreenName = gridScreenName,\n                        ItemName = itemName,\n                        ItemNames = itemNames?.ToList() ?? []\n                    };\n\n                    var result = await new CountInventoryItem(param).Start(cancellationToken);\n                    if (param.ItemName != null)\n                    {\n                        return result;\n                    }\n                    else\n                    {\n                        dynamic expando = new ExpandoObject();\n                        var expandoDict = (IDictionary<string, object>)expando;","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs#L265-L301","documentation":"Exception thrown at line 283 when ScriptObjectConverter.GetValue for gridScreenName returns null — meaning either the gridScreenName key was absent from the config ScriptObject, or its value could not be coerced to the GridScreenName enum. The `?? throw` treats both as 'missing or wrong'. gridScreenName identifies which inventory grid layout to use for counting.","triggerScenarios":"Config object omits gridScreenName entirely. Config provides gridScreenName as an invalid string (typo, wrong casing) or an int that does not map to a GridScreenName member.","commonSituations":"Author forgot the gridScreenName field. Wrong grid name for the current game version. Casing mismatch (GridScreenName values are likely specific strings/enums).","solutions":["Always include gridScreenName in the CountInventoryItem config.","Use a valid GridScreenName value — check the enum definition for accepted members.","Log the raw config object when this fires to see exactly what was passed."],"exampleFix":"// before (JS)\nnew SoloTask('CountInventoryItem', { itemName: 'Mora' }) // missing gridScreenName -> throws\n\n// after (JS)\nnew SoloTask('CountInventoryItem', { gridScreenName: '5x10', itemName: 'Mora' })","handlingStrategy":"validation","validationCode":"// JS side\nif (!cfg.gridScreenName) throw new Error('gridScreenName is required for CountInventoryItem');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include gridScreenName in the CountInventoryItem config.","Use exact GridScreenName enum members.","Log the raw config object when validation fails to spot typos."],"tags":["script","count-inventory","enum","validation"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}