{"record":{"id":"809c54dbb9fa5cfb","repo":"CoplayDev/unity-mcp","slug":"uid-required","errorCode":null,"errorMessage":"uid required","messagePattern":"uid required","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Services/AssetGen/AssetGenJobManager.cs","lineNumber":178,"sourceCode":"            var runner = new Runner\n            {\n                Job = job,\n                SubmitFn = ct => adapter.SubmitAsync(req, apiKey, transport, ct),\n                PollFn = (pid, ct) => adapter.PollAsync(pid, apiKey, transport, ct),\n                ImportFn = ImportOverrideForTests ?? AudioImportPipeline.ImportInto,\n                Transport = transport,\n                OutputFolder = req.OutputFolder,\n                Ext = \"wav\", // default; the poll's ResultExt (wav/mp3) overrides at write time\n                Name = NameFrom(req.Name, req.Prompt, job.JobId),\n                Subfolder = \"Audio\",\n            };\n            Register(job, runner);\n            return job;\n        }\n\n        public static AssetGenJob StartMarketplaceImport(string uid, float targetSize, string name, string outputFolder)\n        {\n            if (string.IsNullOrEmpty(uid)) throw new ArgumentException(\"uid required\");\n            var adapter = AssetGenProviders.Marketplace(\"sketchfab\"); // throws NotSupported if unimplemented\n            var job = NewJob(\"marketplace\", \"sketchfab\", \"import\");\n            job.TargetSize = targetSize <= 0 ? 1f : targetSize;\n            if (!TryResolveKey(\"sketchfab\", job, out string apiKey)) return job;\n            var transport = TransportOverrideForTests ?? new UnityWebRequestTransport();\n            var runner = new Runner\n            {\n                Job = job,\n                SubmitFn = ct => adapter.ResolveDownloadUrlAsync(uid, apiKey, transport, ct),   // returns the zip/gltf URL as providerJobId\n                PollFn = (pid, ct) => Task.FromResult(new ProviderPollResult { State = ProviderPollState.Succeeded, Progress = 1f, DownloadUrl = pid, ResultExt = \"zip\" }),\n                ImportFn = ImportOverrideForTests ?? ModelImportPipeline.ImportInto,\n                Transport = transport,\n                OutputFolder = outputFolder,\n                Ext = \"zip\",\n                Name = NameFrom(name, uid, job.JobId),\n                Subfolder = \"Sketchfab\",\n            };\n            Register(job, runner);","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Services/AssetGen/AssetGenJobManager.cs#L160-L196","documentation":"StartMarketplaceImport requires a non-empty marketplace asset uid (e.g. a Sketchfab model id). It throws ArgumentException ('uid required') immediately if the uid is null or empty, before any provider adapter or network call. The comment notes the adapter itself throws NotSupported if unimplemented downstream.","triggerScenarios":"Calling StartMarketplaceImport with \"\" or null uid; a preceding search step returned no id and that empty value was forwarded into import.","commonSituations":"An AI/LLM omitting the uid; upstream search returning an empty result set whose code path forwarded an absent id; a UI/API caller forgetting to select an asset.","solutions":["Ensure a non-empty marketplace uid is obtained from search results before calling import.","Guard for null/empty uid at the call site and surface a clear error to the user.","If search returned nothing, report 'no results' rather than attempting an import."],"exampleFix":"// before\nAssetGenJob.StartMarketplaceImport(uid: selectedUid, ...); // selectedUid may be null\n\n// after\nif (string.IsNullOrEmpty(selectedUid))\n    return Error(\"Select a marketplace asset first.\");\nAssetGenJob.StartMarketplaceImport(uid: selectedUid, ...);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(uid))\n    throw new ArgumentException(\"A marketplace asset uid is required to start an import.\", nameof(uid));\nAssetGenJob.StartMarketplaceImport(uid, targetSize, name, outputFolder);","typeGuard":"static bool IsValidMarketplaceUid(string uid) => !string.IsNullOrWhiteSpace(uid);","tryCatchPattern":"try { AssetGenJob.StartMarketplaceImport(uid, ...); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"uid required\"))\n{\n    // Upstream search produced no id; prompt the user to select an asset.\n    Report(\"Select a marketplace asset before importing.\");\n}","preventionTips":["Obtain the uid from a successful search before attempting import.","Guard for null/empty/whitespace at the call site.","If search returns no results, surface that rather than forwarding an empty uid."],"tags":["assetgen","marketplace","validation","argument"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}