{"record":{"id":"3e3d55869ae1f81c","repo":"egametang/ET","slug":"state-state","errorCode":null,"errorMessage":"没有正确结束, state={state}","messagePattern":"没有正确结束, state=(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs","lineNumber":196,"sourceCode":"                                                              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\n                sb.Append(keySb.ToString()).Append(indexSb.ToString());\n            }\n\n            if (sb.Length > 0)\n            {\n                chunks.Add(new StrChunk() { TextOrKey = sb.ToString() });\n            }\n\n            SbPool.Put(sb);\n            SbPool.Put(keySb);\n            SbPool.Put(indexSb);\n            var arr = chunks.ToArray();\n            chunks.Clear();\n            return arr;\n        }\n","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs#L178-L214","documentation":"StrUtil.GetStrChunk throws when the string ends while still inside a placeholder (state != ReadText at end of input), e.g. an unclosed '{key1' with no terminating '}'. The message includes the state at termination. Only thrown when throwError=true.","triggerScenarios":"A template ending mid-placeholder: '{key1' (no '}'), '{key' (no index), or '{' (opened but nothing followed).","commonSituations":"Truncated template strings; copy-paste that cut off the closing brace; localization files with incomplete entries.","solutions":["Close every opened placeholder with '}', e.g. '{key1}'.","Validate template length/balance before parsing.","Run with throwError=false to auto-recover partial placeholders."],"exampleFix":"// before\nvar chunks = StrUtil.GetStrChunk(\"{name1\", throwError: true);\n\n// after\nvar chunks = StrUtil.GetStrChunk(\"{name1}\", 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":["Close every opened {key...} placeholder with }.","Validate template brace balance before parsing.","Use tolerant mode for runtime, strict for authoring."],"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"}