CoplayDev/unity-mcp · error · Exception

The following directories do not exist:

Error message

The following directories do not exist:

What it means

Thrown by CurrentProjectValidator.ValidateUnityPackageSettings when one or more entries in ValidationPaths do not exist on disk (Directory.Exists returns false). The message appends every invalid path. This runs only after the null/empty check (error 144) passes, so it indicates paths were supplied but are wrong.

Source

Thrown at TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Validator/Scripts/CurrentProjectValidator.cs:47

                case ValidationType.UnityPackage:
                    ValidateUnityPackageSettings();
                    break;
                default:
                    throw new NotImplementedException("Undefined validation type");
            }
        }

        private void ValidateUnityPackageSettings()
        {
            var invalidPaths = string.Empty;
            foreach (var path in _settings.ValidationPaths)
            {
                if (!Directory.Exists(path))
                    invalidPaths += $"\n{path}";
            }

            if (!string.IsNullOrEmpty(invalidPaths))
                throw new Exception("The following directories do not exist:" + invalidPaths);
        }

        protected override ValidationResult GenerateValidationResult()
        {
            ITestConfig config;
            var applicableTests = GetApplicableTests(ValidationType.Generic);
            switch (_settings.ValidationType)
            {
                case ValidationType.Generic:
                    config = new GenericTestConfig() { ValidationPaths = _settings.ValidationPaths.ToArray() };
                    break;
                case ValidationType.UnityPackage:
                    applicableTests.AddRange(GetApplicableTests(ValidationType.UnityPackage));
                    config = new GenericTestConfig() { ValidationPaths = _settings.ValidationPaths.ToArray() };
                    break;
                default:
                    return new ValidationResult() { Status = ValidationStatus.Failed, Exception = new Exception("Undefined validation type") };
            }

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Cross-check each ValidationPaths entry with Directory.Exists and remove/fix the offenders.
  2. Use paths relative to Application.dataPath (the Assets folder) for stability.
  3. Re-open the validation settings UI and re-pick the folders if assets were reorganized.

Example fix

// before
settings.ValidationPaths = new List<string> { "Assets/OldFolder" };
// after
settings.ValidationPaths = new List<string> { "Assets/RenamedFolder" };
Defensive patterns

Strategy: validation

Validate before calling

var missing = settings.ValidationPaths.Where(p => !Directory.Exists(p)).ToList();
if (missing.Count > 0)
    throw new Exception("Missing: " + string.Join(", ", missing));

Type guard

static bool AllPathsExist(IEnumerable<string> paths) =>
    paths.All(Directory.Exists);

Try / catch

try { validator.ValidateSettings(); }
catch (Exception ex) when (ex.Message.Contains("do not exist")) { /* fix paths */ }

Prevention

When it happens

Trigger: Running UnityPackage/Generic validation where at least one ValidationPaths entry points to a non-existent folder; a path that is a file rather than a directory; or a path whose parent was moved/deleted.

Common situations: Folders renamed or moved after validation settings were saved; relative paths resolved against an unexpected working directory; or a developer typed a path that does not match the project layout.

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/396a7bb15d9dee06. Report an issue: GitHub.