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

  1. Rename keys to start with a lowercase letter a-z, e.g. '{name1}' instead of '{Name1}' or '{1name}'.
  2. Re-run with throwError=false for tolerant parsing during debugging.
  3. 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

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


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/46dbab51a009b32c. Report an issue: GitHub.