egametang/ET · warning · Exception
没有正确结束, state={state}
Error message
没有正确结束, state={state} What it means
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.
Source
Thrown at Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs:196
value));
case 2:
throw new Exception(string.Format("text={2}, index={0}, chr='{1}', 此处只能出现小写英文或1-9的数字", i, c,
value));
case 3:
throw new Exception(string.Format("text={2}, index={0}, chr='{1}', 0-9的数字或'}}'", i, c,
value));
}
}
lastChar = c;
}
//结尾处理
if (state != ReadChunkState.ReadText)
{
if (throwError)
{
throw new Exception("没有正确结束, state=" + state.ToString());
}
sb.Append(keySb.ToString()).Append(indexSb.ToString());
}
if (sb.Length > 0)
{
chunks.Add(new StrChunk() { TextOrKey = sb.ToString() });
}
SbPool.Put(sb);
SbPool.Put(keySb);
SbPool.Put(indexSb);
var arr = chunks.ToArray();
chunks.Clear();
return arr;
}
View on GitHub (pinned to 5cab01f7a8)
Solutions
- Close every opened placeholder with '}', e.g. '{key1}'.
- Validate template length/balance before parsing.
- Run with throwError=false to auto-recover partial placeholders.
Example fix
// before
var chunks = StrUtil.GetStrChunk("{name1", throwError: true);
// after
var chunks = StrUtil.GetStrChunk("{name1}", throwError: true); Defensive patterns
Strategy: validation
Validate before calling
StrUtil.GetStrChunk(template, throwError: false);
Try / catch
try { chunks = StrUtil.GetStrChunk(tpl, throwError: true); }
catch (Exception) { chunks = StrUtil.GetStrChunk(tpl, throwError: false); } Prevention
- Close every opened {key...} placeholder with }.
- Validate template brace balance before parsing.
- Use tolerant mode for runtime, strict for authoring.
When it happens
Trigger: A template ending mid-placeholder: '{key1' (no '}'), '{key' (no index), or '{' (opened but nothing followed).
Common situations: Truncated template strings; copy-paste that cut off the closing brace; localization files with incomplete entries.
Related errors
- text={3}, index={0}, chr='{1}':此处只能出现'{2}'
- text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符
- text={2}, index={0}, chr='{1}', 此处只能出现小写英文或1-9的数字
- text={2}, index={0}, chr='{1}', 0-9的数字或'}}'
- 如果项非string类型,则必需设置解析器
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/3e3d55869ae1f81c.
Report an issue: GitHub.