babalae/better-genshin-impact · error · Exception

地图追踪文件加载失败

Error message

地图追踪文件加载失败

What it means

Thrown by GoToCraftingBenchTask.GoToCraftingBenchOnce when PathingTask.BuildFromFilePath returns null for GameTask\Common\Element\Assets\Json\合成台_{country}.json. Identical mechanism to the AdventurersGuild file-load error but for the crafting-bench pathing asset.

Source

Thrown at BetterGenshinImpact/GameTask/Common/Job/GoToCraftingBenchTask.cs:235

                if (i == _retryTimes - 1)
                {
                    throw;
                }

                await Delay(1000, ct);
                Logger.LogInformation("重试前往合成台");
            }
        }

        Logger.LogInformation("→ {Name} 结束", Name);
    }

    public async Task GoToCraftingBenchOnce(string country, CancellationToken ct)
    {
        var task = PathingTask.BuildFromFilePath(Global.Absolute(@$"GameTask\Common\Element\Assets\Json\合成台_{country}.json"));
        if (task == null)
        {
            throw new Exception("地图追踪文件加载失败");
        }

        var pathingTask = new PathExecutor(ct)
        {
            PartyConfig = new PathingPartyConfig
            {
                Enabled = true,
                AutoSkipEnabled = true,
                AutoRunEnabled = country != "枫丹",
            },
            EndAction = region => Bv.FindFAndPress(region, text: this.craftLocalizedString)
        };
        await pathingTask.Pathing(task);

        await Delay(700, ct);
        
        // 多种尝试 责任链
        if (!IsInCraftingTalkUi())

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Confirm GameTask/Common/Element/Assets/Json/合成台_{country}.json exists for the requested country.
  2. Whitelist country against the set of shipped bench JSON files before calling BuildFromFilePath.
  3. If the file exists, validate it against the pathing-task schema (BuildFromFilePath returns null on parse error).
  4. Ensure the assets are marked CopyToOutputDirectory in the project file.

Example fix

// before
var task = PathingTask.BuildFromFilePath(Global.Absolute(@$"GameTask\Common\Element\Assets\Json\合成台_{country}.json"));
if (task == null) throw new Exception("地图追踪文件加载失败");

// after: include the resolved path in the message
var path = Global.Absolute(@$"GameTask\Common\Element\Assets\Json\合成台_{country}.json");
var task = PathingTask.BuildFromFilePath(path);
if (task == null) throw new Exception($"地图追踪文件加载失败:{path}");
Defensive patterns

Strategy: validation

Validate before calling

var path = Global.Absolute(@$"GameTask\Common\Element\Assets\Json\合成台_{country}.json");
if (!File.Exists(path))
    throw new FileNotFoundException($"合成台路径文件缺失:{path}", path);
var task = PathingTask.BuildFromFilePath(path) ?? throw new Exception("地图追踪文件加载失败:" + path);

Type guard

static bool HasBenchPathing(string country) =>
    File.Exists(Global.Absolute($"GameTask/Common/Element/Assets/Json/合成台_{country}.json"));

Try / catch

null

Prevention

When it happens

Trigger: PathingTask.BuildFromFilePath(Global.Absolute(@$"...\合成台_{country}.json")) returns null. The country value has no shipped bench JSON, the file is missing from the deploy, or the JSON fails to parse.

Common situations: Unsupported/misspelled country (e.g. a region without a 合成台_*.json asset); assets folder not included in the build output; JSON corrupted by manual edit; filename encoding mismatch on a locale-sensitive filesystem.

Related errors


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