egametang/ET · error · Exception
not found package: {p1} {p2}
Error message
not found package: {p1} {p2} What it means
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.
Source
Thrown at Packages/cn.etetet.core/Scripts/Core/Share/Helper/PackageHelper.cs:73
if (packageInfo.source == "embedded")
{
packageInfo.dir = Path.Combine(unityDir, "Packages", packageInfo.version.Replace("file:", ""));
}
else if (packageInfo.source == "git")
{
string p1 = Path.Combine(unityDir, "Library/PackageCache", k + "@" + packageInfo.hash.Substring(0, 10));
string p2 = Path.Combine(unityDir, "Packages", k + "@" + packageInfo.hash);
if (Directory.Exists(p1))
{
packageInfo.dir = p1;
}
else if (Directory.Exists(p2))
{
packageInfo.dir = p2;
}
else
{
throw new Exception($"not found package: {p1} {p2}");
}
}
else
{
packageInfo.dir = Path.Combine(unityDir, "Library/PackageCache", k + "@" + packageInfo.version);
}
}
return packagesLock;
}
}
}View on GitHub (pinned to 5cab01f7a8)
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.
Example fix
// before: tooling runs on a fresh checkout with empty Library var pkgs = PackageHelper.GetPackages(); // after: ensure Unity has imported the project first // 1. Open project in Unity (Library/PackageCache populated) // 2. then run tooling var pkgs = PackageHelper.GetPackages();
Defensive patterns
Strategy: validation
Validate before calling
string p1 = Path.Combine(unityDir, "Library/PackageCache", name + "@" + hash.Substring(0, 10));
string p2 = Path.Combine(unityDir, "Packages", name + "@" + hash);
if (Directory.Exists(p1) || Directory.Exists(p2))
{
// safe to resolve via PackageHelper
} Try / catch
try { var pkgs = PackageHelper.GetPackages(); }
catch (Exception ex) when (ex.Message.Contains("not found package"))
{
Log.Error("Unity packages not restored; open the project in Unity first.");
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ArgumentOutOfRange_Index
- Arg_ArrayPlusOffTooSmall
- Argument_IncompatibleArrayType
- btenv not found key: {key} {typeof(T).FullName}
- 不能把{value.GetType()}转换为{typeof (T)}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/7215155350bdae38.
Report an issue: GitHub.