egametang/ET · error · Exception
condition number parse error: {text}
Error message
condition number parse error: {text} What it means
Thrown by ConditionExprLexer.ReadNumber when a digit run cannot be parsed as a long. The lexer only enters ReadNumber on a leading digit (or a minus followed by a digit), so long.TryParse fails almost exclusively on numeric overflow — the digit string exceeds Int64.MaxValue.
Source
Thrown at Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprLexer.cs:71
++this.index;
}
string text = this.expr.Substring(start, this.index - start);
this.tokens.Add(new ConditionToken(ConditionTokenType.Identifier, text, 0));
}
private void ReadNumber()
{
int start = this.index++;
while (this.index < this.expr.Length && char.IsDigit(this.expr[this.index]))
{
++this.index;
}
string text = this.expr.Substring(start, this.index - start);
if (!long.TryParse(text, out long number))
{
throw new Exception($"condition number parse error: {text}");
}
this.tokens.Add(new ConditionToken(ConditionTokenType.Number, text, number));
}
private void ReadOperator()
{
char c = this.expr[this.index];
switch (c)
{
case '>':
this.AddIfNext('=', ConditionTokenType.GreaterEqual, ConditionTokenType.Greater);
return;
case '<':
this.AddIfNext('=', ConditionTokenType.LessEqual, ConditionTokenType.Less);
return;
case '=':
this.ExpectNext('=', ConditionTokenType.Equal);View on GitHub (pinned to 5cab01f7a8)
Solutions
- Correct the numeric literal in the condition expression (Luban/Excel cell) to fit within long range.
- If the value is genuinely large, redesign to use a scaled unit so it fits.
- Run a config-validation pass that parses all condition expressions at build time to catch overflow early.
Example fix
// before (Luban/Excel expression cell) // HP > 99999999999999999999 // after // HP > 9999999999
Defensive patterns
Strategy: validation
Validate before calling
// Validate config-time: attempt to tokenize/parse all condition expression cells at import. // Reject any cell whose numeric literal exceeds long.MaxValue: // if (ulong.TryParse(numText, out _) && numText.Length > 18) flag for review.
Prevention
- Validate all condition expressions at config-import/build time, not just at runtime.
- Watch for accidental extra digits in Excel/Luban cells.
- Prefer a CI step that compiles every condition expression.
When it happens
Trigger: A condition expression contains an integer literal too large for long, e.g. 'HP > 99999999999999999999' or an extremely large error-code suffix after ':' that exceeds long range.
Common situations: A typo'd extra digit in a config cell; a comparison value or error code copied with too many digits; an Excel/Luban cell formatting artifact that appended zeros.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- condition token error at {this.index}: {c}
- condition variable not registered: {variable}
- condition variable reference invalid: {text}
- condition compare op expected, actual: {token.Text}
- condition root child count error: {node.Children.Count}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/7dc71856cafe90ee.
Report an issue: GitHub.