egametang/ET · warning · Exception
text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符
Error message
text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符 What it means
StrUtil.GetStrChunk error case 1: after an opening '{' (ReadyReadKey state), the next character must be a lowercase letter a-z to begin a key name. Any other character triggers this error. Only thrown when throwError=true.
Source
Thrown at Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs:177
{
throwErrId = 0;
sb.Append(lastChar).Append(c);
}
state = ReadChunkState.ReadText;
break;
}
//处理错误
if (throwError && throwErrId > -1)
{
switch (throwErrId)
{
case 0:
throw new Exception(string.Format("text={3}, index={0}, chr='{1}':此处只能出现'{2}'", i, c,
lastChar, value));
case 1:
throw new Exception(string.Format("text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符", i, c,
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)
{View on GitHub (pinned to 5cab01f7a8)
Solutions
- Rename keys to start with a lowercase letter a-z, e.g. '{name1}' instead of '{Name1}' or '{1name}'.
- Re-run with throwError=false for tolerant parsing during debugging.
- Document the accepted grammar: '{' + lowercase-letters + non-zero-leading-digits + '}'.
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
- Start placeholder keys with lowercase a-z only.
- Document the grammar: {key+digits}, key is lowercase letters.
- Validate templates during authoring.
When it happens
Trigger: A placeholder like '{1key}' (starts with a digit), '{Key}' (uppercase), or '{_key}' (underscore) immediately after the '{'.
Common situations: Template/localization strings using uppercase or digits at the start of a placeholder key; placeholders copied from a different template syntax (e.g. {0}, {Name}) into this parser which expects {%key%num} form.
Related errors
- text={3}, index={0}, chr='{1}':此处只能出现'{2}'
- text={2}, index={0}, chr='{1}', 此处只能出现小写英文或1-9的数字
- text={2}, index={0}, chr='{1}', 0-9的数字或'}}'
- 没有正确结束, state={state}
- 如果项非string类型,则必需设置解析器
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/46dbab51a009b32c.
Report an issue: GitHub.