{"record":{"id":"aff83e1cb21c1021","repo":"babalae/better-genshin-impact","slug":"sourcepath","errorCode":null,"errorMessage":"仓库中不存在路径: {sourcePath}","messagePattern":"仓库中不存在路径: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/ScriptRepoUpdater.cs","lineNumber":1669,"sourceCode":"\n            if (Directory.Exists(scriptPath))\n            {\n                // 复制目录\n                CopyDirectory(scriptPath, destPath);\n            }\n            else if (File.Exists(scriptPath))\n            {\n                // 复制文件\n                var dir = Path.GetDirectoryName(destPath);\n                if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))\n                {\n                    Directory.CreateDirectory(dir);\n                }\n                File.Copy(scriptPath, destPath, true);\n            }\n            else\n            {\n                throw new Exception($\"仓库中不存在路径: {sourcePath}\");\n            }\n        }\n    }\n\n    /// <summary>\n    /// 递归检出树对象\n    /// </summary>\n    private void CheckoutTree(Tree tree, string destPath, string currentPath)\n    {\n        if (!Directory.Exists(destPath))\n        {\n            Directory.CreateDirectory(destPath);\n        }\n\n        foreach (var entry in tree)\n        {\n            var entryDestPath = Path.Combine(destPath, entry.Name);\n            var entrySourcePath = $\"{currentPath}/{entry.Name}\";","sourceCodeStart":1651,"sourceCodeEnd":1687,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/ScriptRepoUpdater.cs#L1651-L1687","documentation":"Thrown in the file-system fallback branch of CheckoutPath (when the repo is NOT a Git repo, i.e., a plain directory): neither Directory.Exists(scriptPath) nor File.Exists(scriptPath) matched, so the requested sourcePath does not exist on disk under repoPath.","triggerScenarios":"CheckoutPath called with a file-based repo (IsGitRepository returns false) and sourcePath that resolves to a path under repoPath which is neither a file nor a directory. This is the file-copy branch; the Git branch returns silently on missing paths, but the file branch throws.","commonSituations":"A manifest references a file that was deleted from the repo; extraction of a zip repo was incomplete; the sourcePath uses separators or casing that don't match the on-disk layout; the repo directory was partially cleaned up.","solutions":["Verify the file-based repo is fully extracted: list repoPath and confirm the sourcePath exists before calling CheckoutPath.","Normalize sourcePath separators and casing to match the OS before the File/Directory.Exists checks.","Re-download or re-import the script repo zip if files are missing.","Make the Git branch and file branch consistent — both should throw or both return silently on missing paths."],"exampleFix":"// before\nelse\n{\n    throw new Exception($\"仓库中不存在路径: {sourcePath}\");\n}\n\n// after (include resolved path)\nelse\n{\n    throw new FileNotFoundException(\n        $\"仓库中不存在路径: {sourcePath}（已解析为 {scriptPath}）\", scriptPath);\n}","handlingStrategy":"validation","validationCode":"// For file-based repos, verify before checkout\nvar resolved = Path.Combine(repoPath, sourcePath);\nif (!File.Exists(resolved) && !Directory.Exists(resolved))\n    throw new FileNotFoundException($\"仓库中不存在路径: {sourcePath}\", resolved);","typeGuard":null,"tryCatchPattern":"catch (FileNotFoundException ex)\n{\n    _logger.LogWarning(ex, \"文件仓库缺少路径，跳过: {Path}\", sourcePath);\n    // optionally skip vs. fail depending on manifest strictness\n}","preventionTips":["Normalize separators/casing before File/Directory.Exists checks.","Re-extract the zip repo if files are unexpectedly missing.","Make the Git and file branches behave consistently on missing paths."],"tags":["filesystem","file-repo","path","manifest","checkout"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}