CoplayDev/unity-mcp · error · Exception
Package was not found
Error message
Package was not found
What it means
Thrown by ExternalProjectValidator.ValidateSettings when PackagePath is null/empty or the file does not exist (File.Exists false). The external validator operates on a single .unitypackage file, so it requires a concrete file path before preparing its temporary validation project.
Source
Thrown at TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Validator/Scripts/ExternalProjectValidator.cs:29
namespace AssetStoreTools.Validator
{
internal class ExternalProjectValidator : ValidatorBase
{
private ExternalProjectValidationSettings _settings;
public ExternalProjectValidator(ExternalProjectValidationSettings settings) : base(settings)
{
_settings = settings;
}
protected override void ValidateSettings()
{
if (_settings == null)
throw new Exception("Validation Settings is null");
if (string.IsNullOrEmpty(_settings.PackagePath)
|| !File.Exists(_settings.PackagePath))
throw new Exception("Package was not found");
}
protected override ValidationResult GenerateValidationResult()
{
bool interactiveMode = false;
try
{
// Step 1 - prepare a temporary project
var result = PrepareTemporaryValidationProject(interactiveMode);
// If preparation was cancelled or setting up project failed - return immediately
if (result.Status == ValidationStatus.Cancelled || result.Status == ValidationStatus.Failed)
return result;
// Step 2 - load the temporary project and validate the package
result = ValidateTemporaryValidationProject(result, interactiveMode);
// Step 3 - copy validation results
View on GitHub (pinned to c21bf496bc)
Solutions
- Set _settings.PackagePath to the absolute path of an existing .unitypackage file.
- Verify File.Exists(_settings.PackagePath) before constructing the validator.
- Ensure the package-export step completes successfully before the validation step runs.
Example fix
// before settings.PackagePath = exportDir; // after settings.PackagePath = Path.Combine(exportDir, "MyPackage.unitypackage");
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(settings.PackagePath) || !File.Exists(settings.PackagePath))
throw new Exception("PackagePath must be an existing .unitypackage file"); Type guard
static bool HasValidPackagePath(ExternalProjectValidationSettings s) =>
!string.IsNullOrEmpty(s?.PackagePath) && File.Exists(s.PackagePath); Try / catch
try { validator.ValidateSettings(); }
catch (Exception ex) when (ex.Message.Contains("Package was not found")) { ... } Prevention
- Verify the export step produced the .unitypackage before validating.
- Store absolute paths to avoid working-directory ambiguity.
When it happens
Trigger: Constructing ExternalProjectValidator with settings whose PackagePath is unset, empty, or points to a non-existent file; passing a directory instead of a file; or referencing a package that was deleted after selection.
Common situations: The .unitypackage was built to a different output location, a build step failed silently so the file is missing, or the path was cleared in the settings asset. Common when automating validation with a computed output path.
Related errors
- No validation paths were set
- The following directories do not exist:
- Path does not correspond to a valid package
- Source directory not found: {dir.FullName}
- Could not find external project's validation results
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/cc06e26291a0e7e9.
Report an issue: GitHub.