{"record":{"id":"36684fee5b624463","repo":"babalae/better-genshin-impact","slug":"mainaffixtext-36684f","errorCode":null,"errorMessage":"未找到主词条数值对应的行：\n{mainAffixText}","messagePattern":"未找到主词条数值对应的行：\n(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoArtifactSalvage/AutoArtifactSalvageTask.cs","lineNumber":602,"sourceCode":"                if (mainAffixType == ArtifactAffixType.ATK && !String.IsNullOrEmpty(match.Groups[2].Value))\n                {\n                    mainAffixType = ArtifactAffixType.ATKPercent;\n                }\n                if (mainAffixType == ArtifactAffixType.DEF && !String.IsNullOrEmpty(match.Groups[2].Value))\n                {\n                    mainAffixType = ArtifactAffixType.DEFPercent;\n                }\n                if (mainAffixType == ArtifactAffixType.HP && !String.IsNullOrEmpty(match.Groups[2].Value))\n                {\n                    mainAffixType = ArtifactAffixType.HPPercent;\n                }\n                return match.Groups[1].Value;\n            }\n            else\n            {\n                return null;\n            }\n        }).Where(l => l != null).Cast<string>().SingleOrDefault() ?? throw new Exception($\"未找到主词条数值对应的行：\\n{mainAffixText}\");\n        if (!float.TryParse(mainAffixValueLine, NumberStyles.Any, this.cultureInfo, out float value))\n        {\n            throw new Exception($\"未识别的主词条数值：{mainAffixValueLine}\");\n        }\n        ArtifactAffix mainAffix = new ArtifactAffix(mainAffixType, value);\n        #endregion\n\n        #region 副词条\n        var minorAffixes = new List<ArtifactAffix>();\n        string pattern = @\"^([^+:：]+)\\+([\\d., 。]*)(%?).*$\";\n        pattern = pattern.Replace(\"%\", percentStr);\n        foreach (var r in levelAndMinorAffixResult)\n        {\n            Match match = Regex.Match(r.Text, pattern);\n            if (!match.Success)\n            {\n                continue;\n            }","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoArtifactSalvage/AutoArtifactSalvageTask.cs#L584-L620","documentation":"Thrown when the main-affix value line cannot be found: the LINQ Select over mainAffixLines matching the numeric pattern '^([\\d., ]*)(%?)$' yields no single match. The artifact's main stat type was identified (152 passed) but its numeric value line is missing.","triggerScenarios":"OCR split the value across multiple lines or merged it with the type label; value contains characters the regex rejects (e.g. local decimal separator not in [\\d., ]); the threshold step removed the value text; multiple lines matched causing SingleOrDefault to throw InvalidOperationException instead (distinct failure).","commonSituations":"Locale using a thousands separator outside the allowed set (e.g. space grouping already allowed, but apostrophe in some locales); UI scale change cropped the value out of mainAffixRoi; OCR mis-detection.","solutions":["Check allText / mainAffixText to see the captured value line format.","Confirm cultureInfo matches the in-game number formatting.","Widen mainAffixRoi if the value moved outside the crop.","Adjust the numeric regex to accept the locale's separators."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* parse main affix value */ }\ncatch (Exception e) when (e.Message.Contains(\"主词条数值\")) { if (policy == RecognitionFailurePolicy.Skip) continue; throw; }","preventionTips":["Confirm cultureInfo's decimal/thousands separators match OCR output.","Inspect mainAffixText to validate the captured lines.","Widen mainAffixRoi if the value line is cropped out.","Allow RecognitionFailurePolicy to skip unreliable cards."],"tags":["game-task","ocr","artifact","recognition","regex"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}