{"record":{"id":"f94375b1991e8750","repo":"egametang/ET","slug":"text-2-index-0-chr-1-1-9","errorCode":null,"errorMessage":"text={2}, index={0}, chr='{1}', 此处只能出现小写英文或1-9的数字","messagePattern":"text=(.+?), index=(.+?), chr='(.+?)', 此处只能出现小写英文或1-9的数字","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs","lineNumber":180,"sourceCode":"                        }\n\n                        state = ReadChunkState.ReadText;\n                        break;\n                }\n\n                //处理错误\n                if (throwError && throwErrId > -1)\n                {\n                    switch (throwErrId)\n                    {\n                        case 0:\n                            throw new Exception(string.Format(\"text={3}, index={0}, chr='{1}'：此处只能出现'{2}'\", i, c,\n                                                              lastChar, value));\n                        case 1:\n                            throw new Exception(string.Format(\"text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符\", i, c,\n                                                              value));\n                        case 2:\n                            throw new Exception(string.Format(\"text={2}, index={0}, chr='{1}', 此处只能出现小写英文或1-9的数字\", i, c,\n                                                              value));\n                        case 3:\n                            throw new Exception(string.Format(\"text={2}, index={0}, chr='{1}', 0-9的数字或'}}'\", i, c,\n                                                              value));\n                    }\n                }\n\n                lastChar = c;\n            }\n\n            //结尾处理\n            if (state != ReadChunkState.ReadText)\n            {\n                if (throwError)\n                {\n                    throw new Exception(\"没有正确结束, state=\" + state.ToString());\n                }\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs#L162-L198","documentation":"StrUtil.GetStrChunk error case 2: while reading a key name (ReadKey state), after the initial lowercase letters, the parser expects either more lowercase letters (a-z) or a digit 1-9 to start the index. Any other character (e.g. uppercase, symbol, space) triggers this. Only thrown when throwError=true.","triggerScenarios":"A placeholder like '{key_1}' (underscore), '{key-1}' (hyphen), '{key 1}' (space), or '{keyA1}' (uppercase mid-key).","commonSituations":"Keys with separators or mixed case that the grammar does not allow; templates authored with a different naming convention.","solutions":["Use only lowercase letters for the key portion and start the index with 1-9, e.g. '{keyname1}'.","Remove separators/uppercase from placeholder keys.","Validate templates with throwError=false first to locate the bad placeholder."],"exampleFix":"// before\nvar chunks = StrUtil.GetStrChunk(\"{player_1}\", throwError: true);\n\n// after\nvar chunks = StrUtil.GetStrChunk(\"{player1}\", throwError: true);","handlingStrategy":"validation","validationCode":"StrUtil.GetStrChunk(template, throwError: false);","typeGuard":null,"tryCatchPattern":"try { chunks = StrUtil.GetStrChunk(tpl, throwError: true); }\ncatch (Exception) { chunks = StrUtil.GetStrChunk(tpl, throwError: false); }","preventionTips":["Use only lowercase letters then digits in keys; no separators or uppercase.","Run tolerant parse to locate offending placeholders.","Enforce template grammar in the authoring tool."],"tags":["packagemanager","editor","parsing","string-template"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}