{"record":{"id":"6a2432691d42fcd7","repo":"CoplayDev/unity-mcp","slug":"path-does-not-correspond-to-a-valid-package","errorCode":null,"errorMessage":"Path does not correspond to a valid package","messagePattern":"Path does not correspond to a valid package","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Uploader/Scripts/Data/HybridPackageWorkflow.cs","lineNumber":57,"sourceCode":"        {\r\n            return _packageInfo;\r\n        }\r\n\r\n        public void SetPackage(PackageInfo packageInfo, bool serialize)\r\n        {\r\n            if (packageInfo == null)\r\n                throw new ArgumentException(\"Package is null\");\r\n\r\n            _packageInfo = packageInfo;\r\n            SetMetadata();\r\n            if (serialize)\r\n                Serialize();\r\n        }\r\n\r\n        public void SetPackage(string packageManifestPath, bool serialize)\r\n        {\r\n            if (!PackageUtility.GetPackageByManifestPath(packageManifestPath, out var package))\r\n                throw new ArgumentException(\"Path does not correspond to a valid package\");\r\n\r\n            SetPackage(package, serialize);\r\n        }\r\n\r\n        private void SetMetadata()\r\n        {\r\n            LocalPackageGuid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(_packageInfo.GetManifestAsset()));\r\n            LocalPackagePath = _packageInfo.assetPath;\r\n            LocalProjectPath = _packageInfo.name;\r\n        }\r\n\r\n        public List<PackageInfo> GetDependencies()\r\n        {\r\n            return _dependencies;\r\n        }\r\n\r\n        public void SetDependencies(IEnumerable<string> dependencies, bool serialize)\r\n        {\r","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Uploader/Scripts/Data/HybridPackageWorkflow.cs#L39-L75","documentation":"Thrown by HybridPackageWorkflow.SetPackage when PackageUtility.GetPackageByManifestPath cannot resolve the given packageManifestPath to a Unity package. The asset-store uploader relies on Unity's package resolver to locate a package.json and its PackageInfo; if the manifest path is invalid or not inside a recognized package, the resolver returns false and this ArgumentException is raised before any metadata is set.","triggerScenarios":"Calling AssetStoreUploader with a packageManifestPath that does not point to a valid package.json, points to a file outside the Packages folder, is a removed/embedded-local package not yet imported, or a path with the wrong casing/separators on case-sensitive systems.","commonSituations":"A package was deleted or renamed between selection and upload; the path passed is the folder rather than the package.json; or a Local/Embedded package is not yet registered by Unity's AssetDatabase. Common after moving a package or switching branches.","solutions":["Verify the path points to an existing package.json inside Packages/<package-id>/.","Force Unity to refresh package resolution: trigger an AssetDatabase refresh or reimport before uploading.","If the package was moved, re-select it through the uploader UI so it stores the resolved manifest path.","Confirm the manifest path uses forward slashes and correct casing on macOS/Linux editors."],"exampleFix":"// before\nworkflow.SetPackage(\"Packages/com.my.pkg\", serialize: true);\n// after\nworkflow.SetPackage(\"Packages/com.my.pkg/package.json\", serialize: true);","handlingStrategy":"validation","validationCode":"if (!PackageUtility.GetPackageByManifestPath(path, out var pkg))\n    throw new ArgumentException($\"Not a valid package manifest: {path}\");","typeGuard":"static bool IsValidManifestPath(string path) =>\n    !string.IsNullOrEmpty(path)\n    && path.EndsWith(\"package.json\")\n    && File.Exists(path)\n    && PackageUtility.GetPackageByManifestPath(path, out _);","tryCatchPattern":"try { workflow.SetPackage(path, serialize: true); }\ncatch (ArgumentException ex) { Debug.LogError(ex.Message); }","preventionTips":["Always pass the package.json file path, not the folder.","Re-resolve the package after moving/renaming it."],"tags":["csharp","unity","asset-store","package","validation"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}