babalae/better-genshin-impact · warning · FileNotFoundException
repo.json 仓库索引文件不存在,请至少成功更新一次仓库!
Error message
repo.json 仓库索引文件不存在,请至少成功更新一次仓库!
What it means
Thrown by the private GetRepoJsonPath helper: it first tries ScriptRepoUpdater.RepoUpdatedJsonPath, and if absent, falls back to a recursive search for repo.json under CenterRepoPath. If neither exists it throws FileNotFoundException. This helper feeds GetRepoJson and UpdateSubscribed, so the message surfaces inside their catch blocks.
Source
Thrown at BetterGenshinImpact/Core/Script/WebView/RepoWebBridge.cs:264
Console.WriteLine(e);
return false;
}
}
private static string GetRepoJsonPath()
{
string updatedRepoJsonPath = ScriptRepoUpdater.RepoUpdatedJsonPath;
if (File.Exists(updatedRepoJsonPath))
{
return updatedRepoJsonPath;
}
string? repoJson = Directory
.GetFiles(ScriptRepoUpdater.CenterRepoPath, "repo.json", SearchOption.AllDirectories)
.FirstOrDefault();
return repoJson ?? throw new FileNotFoundException("repo.json 仓库索引文件不存在,请至少成功更新一次仓库!");
}
internal static void ProcessPathRecursively(JArray array, string[] pathParts, int currentIndex)
{
foreach (JObject item in array.OfType<JObject>())
{
if (item["name"]?.ToString() != pathParts[currentIndex]) continue;
if (currentIndex == pathParts.Length - 1)
{
ResetHasUpdateFlag(item);
}
else if (item["children"] is JArray children)
{
ProcessPathRecursively(children, pathParts, currentIndex + 1);
}
break;
}View on GitHub (pinned to a7cb36712d)
Solutions
- Perform a full repository update to materialize repo.json and RepoUpdatedJsonPath.
- If only RepoUpdatedJsonPath is missing, run ClearUpdate to copy repo.json back, but first confirm repo.json exists (else 144).
- Check write permissions and disk space under CenterRepoPath so the update can persist the json.
- Re-clone the repo if the folder is corrupt.
Defensive patterns
Strategy: validation
Validate before calling
static bool RepoJsonAvailable() =>
File.Exists(ScriptRepoUpdater.RepoUpdatedJsonPath) ||
Directory.Exists(ScriptRepoUpdater.CenterRepoPath) &&
Directory.GetFiles(ScriptRepoUpdater.CenterRepoPath, "repo.json", SearchOption.AllDirectories).Length > 0; Prevention
- Ensure a successful repo update before reading repo.json.
- Run ClearUpdate to regenerate RepoUpdatedJsonPath from repo.json.
- Treat a missing repo.json as 'update required', not a crash.
When it happens
Trigger: No local repo.json and no RepoUpdatedJsonPath — i.e. repo never updated, or updated but the json was deleted/never written. Reached when CenterRepoPath exists (else 142/143 would fire first) but contains no repo.json anywhere beneath it.
Common situations: First run without an update; partial update that created the folder but failed before writing repo.json; RepoUpdatedJsonPath cleared by ClearUpdate then the source repo.json deleted.
Related errors
- 仓库文件夹不存在,请至少成功更新一次仓库!
- 找不到原始 repo.json 文件
- 文件 '{relativePath}' 不存在
- 读取文件失败: {ex.Message}
- 写入文件失败: {ex.Message}
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/b63b681675118aab.
Report an issue: GitHub.