babalae/better-genshin-impact · error · Exception

当前在全部歌曲页面,此页面无法运行本任务。请返回到主界面选择专辑列表中以国家为主题的专辑页!

Error message

当前在全部歌曲页面,此页面无法运行本任务。请返回到主界面选择专辑列表中以国家为主题的专辑页!

What it means

Thrown by StartOneAlbum when the album icon IS present but OCR of the region to its right contains '全部', indicating the user is on the all-songs page rather than a single country album. The task cannot run from the all-songs view.

Source

Thrown at BetterGenshinImpact/GameTask/AutoMusicGame/AutoAlbumTask.cs:63

        }
    }

    public async Task StartOneAlbum(CancellationToken ct)
    {
        using var ra1 = CaptureToRectArea();
        using var iconRa = ra1.Find(RecognitionAssets.Get("AutoMusicGame", "UiLeftTopAlbumIcon", ra1));
        if (!iconRa.IsExist())
        {
            throw new Exception("当前未处于主题专辑界面,请在专辑界面运行本任务。注意全部歌曲列表页面无法运行本任务!");
        }
        else
        {
            // OCR 后再次判断,区分是否是全部歌曲页面
            using var ocrArea = ra1.DeriveCrop(iconRa.Right, iconRa.Top, ra1.Width * 0.16, iconRa.Height);
            var ocrRes = ocrArea.FindMulti(RecognitionObject.OcrThis);
            if (ocrRes.Any(region => region.Text.Contains("全部")))
            {
                throw new Exception("当前在全部歌曲页面,此页面无法运行本任务。请返回到主界面选择专辑列表中以国家为主题的专辑页!");
            }
        }

        var musicLevel = TaskContext.Instance().Config.AutoMusicGameConfig.MusicLevel;
        if (string.IsNullOrEmpty(musicLevel))
        {
            musicLevel = "传说";
        }

        Logger.LogInformation("自动音游乐曲难度等级:{Text}", musicLevel);

        // 遍历4个难度等级
        var defaultDifficultyLevels = new[]
        {
            ("普通", 480, 600, RecognitionAssets.Get("AutoMusicGame", "MusicCanorusLevel1", ra1)),
            ("困难", 800, 600, RecognitionAssets.Get("AutoMusicGame", "MusicCanorusLevel2", ra1)),
            ("大师", 1150, 600, RecognitionAssets.Get("AutoMusicGame", "MusicCanorusLevel3", ra1)),
            ("传说", 1400, 600, RecognitionAssets.Get("AutoMusicGame", "MusicCanorusLevel4", ra1))

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Return to the album list and select a specific country-themed album (not '全部').
  2. If the in-game layout changed and '全部' appears on valid album pages too, tighten the OCR ROI so it only matches the all-songs header.
  3. Re-run StartOneAlbum once on the correct page.
Defensive patterns

Strategy: validation

Try / catch

try { await StartOneAlbum(ct); }
catch (Exception ex) when (ex.Message.Contains("全部歌曲页面"))
{
    Logger.LogWarning("当前在全部歌曲页面,请在专辑列表中选择国家主题专辑后重试");
}

Prevention

When it happens

Trigger: iconRa exists; ocrArea.FindMulti(RecognitionObject.OcrThis) returns at least one region whose Text.Contains("全部") → throw.

Common situations: User navigated to the '全部歌曲' (all songs) listing instead of a country album; OCR picks up the '全部' filter/tab text.

Related errors


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