babalae/better-genshin-impact · error · Exception

未识别的副词条:{match.Groups[1].Value}

Error message

未识别的副词条:{match.Groups[1].Value}

What it means

Thrown during minor-affix parsing when match.Groups[1].Value (the affix name) does not contain any of the localized affix strings in artifactAffixStrDic (ATK/DEF/HP/CRITRate/CRITDMG/ElementalMastery/EnergyRecharge). A line matched the minor-affix regex '^([^+::]+)\+([\d., 。]*)(%?).*$' but its name is not a known stat.

Source

Thrown at BetterGenshinImpact/GameTask/AutoArtifactSalvage/AutoArtifactSalvageTask.cs:674

            else if (match.Groups[1].Value.Contains(dic[ArtifactAffixType.CRITRate]))
            {
                artifactAffixType = ArtifactAffixType.CRITRate;
            }
            else if (match.Groups[1].Value.Contains(dic[ArtifactAffixType.CRITDMG]))
            {
                artifactAffixType = ArtifactAffixType.CRITDMG;
            }
            else if (match.Groups[1].Value.Contains(dic[ArtifactAffixType.ElementalMastery]))
            {
                artifactAffixType = ArtifactAffixType.ElementalMastery;
            }
            else if (match.Groups[1].Value.Contains(dic[ArtifactAffixType.EnergyRecharge]))
            {
                artifactAffixType = ArtifactAffixType.EnergyRecharge;
            }
            else
            {
                throw new Exception($"未识别的副词条:{match.Groups[1].Value}");
            }

            if (!float.TryParse(match.Groups[2].Value.Replace("。", "."), NumberStyles.Any, cultureInfo, out float affixValue))
            {
                throw new Exception($"未识别的副词条数值:{match.Groups[2].Value}");
            }

            bool isUnactivated = false;
            // 只有在已经成功识别至少 3 个词条后才执行额外的直方图分析。
            if (minorAffixes.Count >= 3)
            {
                using var lineRoi = levelAndMinorAffixRoi.SubMat(r.Rect);
                using var lineHistogram = new Mat();
                Cv2.CalcHist(
                    images: [lineRoi],
                    channels: [0],
                    mask: null,
                    hist: lineHistogram,

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Inspect the offending line text (match.Groups[1].Value) via logging.
  2. Confirm language/cultureInfo alignment with the in-game client.
  3. Tighten the regex or pre-filter so set-bonus/level lines are excluded (the code already filters left-aligned regions).
  4. Add the missing affix to ArtifactAffix.DefaultStrDic if it is a legitimate new stat.
Defensive patterns

Strategy: try-catch

Try / catch

try { /* minor affix parse loop */ }
catch (Exception e) when (e.Message.Contains("副词条")) { if (policy == RecognitionFailurePolicy.Skip) continue; throw; }

Prevention

When it happens

Trigger: OCR captured a non-affix line that happened to match the 'X+Y' shape (e.g. a set-bonus line, a level line like '+15'); localized affix name OCR'd slightly wrong so .Contains fails; new/unknown affix type not in the dictionary.

Common situations: Game language mismatch; OCR substitution errors on stat names; a line from another part of the card bled into levelAndMinorAffixRoi; the artifact has an affix type the dictionary does not cover.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/d7cb2c90932f938d. Report an issue: GitHub.