{"record":{"id":"043d019797731457","repo":"egametang/ET","slug":"condition-node-params-field-must-be-string-nod","errorCode":null,"errorMessage":"condition node params field must be string[]: {node.GetType().FullName}.Params","messagePattern":"condition node params field must be string\\[\\]: (.+?)\\.Params","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprParser.cs","lineNumber":307,"sourceCode":"            if (fieldInfo.FieldType != typeof(string))\n            {\n                throw new Exception($\"condition node owner key field must be string: {node.GetType().FullName}.{nameof(BTNumericCompare.OwnerKey)}\");\n            }\n\n            fieldInfo.SetValue(node, ownerKey);\n        }\n\n        private void SetParamsField(BTCondition node, string[] paramValues)\n        {\n            FieldInfo fieldInfo = node.GetType().GetField(\"Params\", BindingFlags.Instance | BindingFlags.Public);\n            if (fieldInfo == null)\n            {\n                throw new Exception($\"condition node params field not found: {node.GetType().FullName}.Params\");\n            }\n\n            if (fieldInfo.FieldType != typeof(string[]))\n            {\n                throw new Exception($\"condition node params field must be string[]: {node.GetType().FullName}.Params\");\n            }\n\n            fieldInfo.SetValue(node, paramValues);\n        }\n\n        private void AddSequenceChild(BTSequence sequence, BTNode child)\n        {\n            if (child is BTSequence childSequence)\n            {\n                sequence.Children.AddRange(childSequence.Children);\n                return;\n            }\n\n            sequence.Children.Add(child);\n        }\n\n        private void AddSelectorChild(BTSelector selector, BTNode child)\n        {","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprParser.cs#L289-L325","documentation":"Thrown by SetParamsField when the `Params` field exists but its element type is not exactly `string[]` (e.g. declared as `object[]`, `int[]`, or `List<string>`). The parser hands in a string array of raw argument tokens, so a mismatched element type is rejected rather than coerced.","triggerScenarios":"Declaring `public object[] Params;` or `public List<string> Params;` on a node and then using the `NodeName(a, b)` parameter syntax.","commonSituations":"Author wants typed parameters and tries `int[] Params` expecting auto-conversion; refactor changes the collection type from array to List.","solutions":["Declare the field as `public string[] Params;` and parse element values inside the node's execution.","Keep typed conversion logic in the node; the parser only carries raw string tokens."],"exampleFix":"// before\npublic int[] Params;\n// after\npublic string[] Params;","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static bool ParamsIsStringArray(Type t)\n{\n    var f = t.GetField(\"Params\", BindingFlags.Instance | BindingFlags.Public);\n    return f != null && f.FieldType == typeof(string[]);\n}","tryCatchPattern":null,"preventionTips":["Always declare Params as `public string[]`.","Do typed parsing inside the node; the parser carries only raw tokens.","Scan registered nodes to assert Params element type."],"tags":["csharp","unity","conditionexpr","reflection","attribute"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}