{"record":{"id":"7215155350bdae38","repo":"egametang/ET","slug":"not-found-package-p1-p2","errorCode":null,"errorMessage":"not found package: {p1} {p2}","messagePattern":"not found package: (.+?) (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.core/Scripts/Core/Share/Helper/PackageHelper.cs","lineNumber":73,"sourceCode":"                if (packageInfo.source == \"embedded\")\n                {\n                    packageInfo.dir = Path.Combine(unityDir, \"Packages\", packageInfo.version.Replace(\"file:\", \"\"));\n                }\n                else if (packageInfo.source == \"git\")\n                {\n                    string p1 = Path.Combine(unityDir, \"Library/PackageCache\", k + \"@\" + packageInfo.hash.Substring(0, 10));\n                    string p2 = Path.Combine(unityDir, \"Packages\", k + \"@\" + packageInfo.hash);\n                    if (Directory.Exists(p1))\n                    {\n                        packageInfo.dir = p1;\n                    }\n                    else if (Directory.Exists(p2))\n                    {\n                        packageInfo.dir = p2;\n                    }\n                    else\n                    {\n                        throw new Exception($\"not found package: {p1} {p2}\");\n                    }\n                }\n                else\n                {\n                    packageInfo.dir = Path.Combine(unityDir, \"Library/PackageCache\", k + \"@\" + packageInfo.version);\n                }\n            }\n            \n            return packagesLock;\n        }\n    }\n}","sourceCodeStart":55,"sourceCodeEnd":85,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.core/Scripts/Core/Share/Helper/PackageHelper.cs#L55-L85","documentation":"Thrown by PackageHelper when neither the PackageCache path (Library/PackageCache/<name>@<hash10>) nor the Packages/<name>@<hash> path exists for a resolved package. The resolver computed candidate directories from the package's name+hash and found none on disk.","triggerScenarios":"A Unity package resolved in the manifest but missing from Library/PackageCache and Packages; hash mismatch after a Unity version/library rebuild; package pulled from a git/tarball source not stored in PackageCache; CI without a populated Library.","commonSituations":"Fresh checkout or CI where Unity hasn't imported packages into Library yet; partial/corrupted Library folder; renamed/moved package; Unity version change invalidating cached hashes; embedded/local packages not under PackageCache.","solutions":["Open the project in Unity once so it restores packages into Library/PackageCache before running tooling.","Verify the package exists in manifest.json / Packages and its resolved hash matches the directory on disk.","For local/embedded packages, handle them via the Packages/<name> path rather than PackageCache hash lookup.","Clean and let Unity rebuild Library if the hash directory is stale or missing."],"exampleFix":"// before: tooling runs on a fresh checkout with empty Library\nvar pkgs = PackageHelper.GetPackages();\n\n// after: ensure Unity has imported the project first\n// 1. Open project in Unity (Library/PackageCache populated)\n// 2. then run tooling\nvar pkgs = PackageHelper.GetPackages();","handlingStrategy":"validation","validationCode":"string p1 = Path.Combine(unityDir, \"Library/PackageCache\", name + \"@\" + hash.Substring(0, 10));\nstring p2 = Path.Combine(unityDir, \"Packages\", name + \"@\" + hash);\nif (Directory.Exists(p1) || Directory.Exists(p2))\n{\n    // safe to resolve via PackageHelper\n}","typeGuard":null,"tryCatchPattern":"try { var pkgs = PackageHelper.GetPackages(); }\ncatch (Exception ex) when (ex.Message.Contains(\"not found package\"))\n{\n    Log.Error(\"Unity packages not restored; open the project in Unity first.\");\n}","preventionTips":["Open the project in Unity once before running package tooling so Library is populated.","On CI, restore Unity packages before invoking PackageHelper.","Handle local/embedded packages via Packages/<name>, not PackageCache hash lookup."],"tags":["unity","package","packagecache","ci","build","core"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}