{"record":{"id":"a2790ff6d7a054c5","repo":"babalae/better-genshin-impact","slug":"withtimeout-withretryinterval-until","errorCode":null,"errorMessage":"一次性动作不支持 WithTimeout 或 WithRetryInterval，请使用 Until 系列方法设置重试条件","messagePattern":"一次性动作不支持 WithTimeout 或 WithRetryInterval，请使用 Until 系列方法设置重试条件","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"BetterGenshinImpact/Core/BgiVision/BvFlowAction.cs","lineNumber":220,"sourceCode":"\n    public BvFlow UntilAllDisappear(object targets)\n    {\n        return Complete(BvFlow.ParseTargets(targets, nameof(targets)), BvFlowCondition.AllDisappear);\n    }\n\n    public Task<BvPage> Run()\n    {\n        return CompleteOnce().Run();\n    }\n\n    private BvFlow CompleteOnce()\n    {\n        lock (_syncRoot)\n        {\n            EnsureNotCompleted();\n            if (_timeout is not null || _retryInterval is not null)\n            {\n                throw new InvalidOperationException(\n                    \"一次性动作不支持 WithTimeout 或 WithRetryInterval，请使用 Until 系列方法设置重试条件\");\n            }\n\n            _completed = true;\n        }\n\n        return _flow.AddOnceActionStep(_description, _action);\n    }\n\n    private BvFlow Complete(IReadOnlyList<BvLocator> targets, BvFlowCondition condition)\n    {\n        int timeout;\n        int retryInterval;\n        lock (_syncRoot)\n        {\n            EnsureNotCompleted();\n            _completed = true;\n            timeout = _timeout ?? _flow.DefaultTimeout;","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/BgiVision/BvFlowAction.cs#L202-L238","documentation":"Thrown by DecodeDataUri after decoding a base64 or URL-encoded data URI payload, when the resulting byte array exceeds MaxDownloadBytes (20 MB). This is the data-URI equivalent of the file/HTTP size guards, preventing large embedded images from consuming memory.","triggerScenarios":"DecodeDataUri decodes the payload (base64 or UTF8 URL-decoded) and checks bytes.Length > MaxDownloadBytes. Triggered by Markdown embedding a very large base64-encoded image directly in the document.","commonSituations":"User pastes a full-resolution photo as a data URI into Markdown, a tool auto-embeds images as base64 without size filtering, or the Markdown document itself becomes very large from embedded data.","solutions":["Replace the data URI with a file reference or URL to a compressed image.","Compress/resize the image before base64-encoding.","Increase MaxDownloadBytes if large embedded images are expected (recompile)."],"exampleFix":"// before\nif (bytes.Length > MaxDownloadBytes)\n    throw new InvalidDataException($\"图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。\");\n\n// after — return empty and warn\nif (bytes.Length > MaxDownloadBytes)\n{\n    _owner.ReportDiagnostic(new MarkdownDiagnostic(MarkdownDiagnosticSeverity.Warning,\n        $\"data URI 图片大小 {bytes.Length / 1024 / 1024} MB 超过限制，已跳过。\"));\n    return Array.Empty<byte>();\n}","handlingStrategy":"validation","validationCode":"// Pre-check decoded length is infeasible without decoding;\n// validate base64 length as a proxy: decoded ≈ base64len * 3/4\nvar estBytes = (data.Length * 3) / 4;\nif (estBytes > MaxDownloadBytes) return Placeholder;","typeGuard":null,"tryCatchPattern":"try { bytes = DecodeDataUri(source.OriginalString); }\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"MB 限制\"))\n{ return MarkdownImageResult.Placeholder; }","preventionTips":["Avoid embedding large images as data URIs in Markdown.","Estimate decoded size from base64 length before full decode.","Use file or URL references instead of inline base64 for large images."],"tags":["markdown","image","data-uri","size-limit"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}