{"record":{"id":"dfa58694a7acd6fb","repo":"CoplayDev/unity-mcp","slug":"failed-to-download-packageid-request-error","errorCode":null,"errorMessage":"Failed to download {packageId}: {request.error}","messagePattern":"Failed to download (.+?): (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Setup/RoslynInstaller.cs","lineNumber":99,"sourceCode":"                    {\n                        EditorUtility.DisplayProgressBar(\n                            \"Installing Roslyn\",\n                            $\"Downloading {packageId} v{pkgVersion}...\",\n                            (float)i / NuGetEntries.Length);\n                    }\n\n                    string url =\n                        $\"https://api.nuget.org/v3-flatcontainer/{packageId}/{pkgVersion}/{packageId}.{pkgVersion}.nupkg\";\n\n                    using (var request = UnityWebRequest.Get(url))\n                    {\n                        request.timeout = 30;\n                        request.SendWebRequest();\n                        while (!request.isDone)\n                            System.Threading.Thread.Sleep(50);\n\n                        if (request.result != UnityWebRequest.Result.Success)\n                            throw new Exception($\"Failed to download {packageId}: {request.error}\");\n\n                        byte[] nupkgBytes = request.downloadHandler.data;\n                        byte[] dllBytes = ExtractFileFromZip(nupkgBytes, dllPathInZip);\n\n                        if (dllBytes == null)\n                        {\n                            Debug.LogError($\"[MCP] Could not find {dllPathInZip} in {packageId}.{pkgVersion}.nupkg\");\n                            continue;\n                        }\n\n                        string destPath = Path.Combine(destFolder, dllName);\n                        File.WriteAllBytes(destPath, dllBytes);\n                        Debug.Log($\"[MCP] Extracted {dllName} ({dllBytes.Length / 1024}KB) → Assets/{PluginsRelPath}/{dllName}\");\n                    }\n                }\n\n                if (interactive)\n                    EditorUtility.DisplayProgressBar(\"Installing Roslyn\", \"Refreshing assets...\", 0.95f);","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Setup/RoslynInstaller.cs#L81-L117","documentation":"Thrown by RoslynInstaller.Install when a UnityWebRequest.Get against the NuGet flat container (api.nuget.org) does not return Success. The installer downloads .nupkg zips and extracts the Roslyn DLLs that power the runtime_compilation tool; a failed download aborts the whole install.","triggerScenarios":"Network is offline or api.nuget.org is unreachable; the 30-second request timeout is exceeded on a slow link; a corporate proxy or SSL/certificate error fails the request; the specific package/version was delisted from NuGet.","commonSituations":"Corporate firewall blocks nuget.org; air-gapped Unity machine; transient NuGet outage; slow connection timing out at the hardcoded 30s.","solutions":["Verify connectivity to https://api.nuget.org from the Unity machine.","Retry the install once network is stable.","Manually place the required DLLs (Microsoft.CodeAnalysis 4.12.0, CSharp, System.Collections.Immutable 8.0.0, System.Reflection.Metadata 8.0.0, System.Runtime.CompilerServices.Unsafe 6.0.0) into Assets/Plugins/Roslyn.","Configure a working proxy in Unity/OS settings if behind a corporate network."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    RoslynInstaller.Install(interactive: true);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"Failed to download\"))\n{\n    Debug.LogError($\"NuGet download failed (network): {ex.Message}. Place DLLs manually in Assets/Plugins/Roslyn.\");\n}","preventionTips":["Confirm api.nuget.org is reachable before installing in restricted networks.","Pre-stage the DLLs in Assets/Plugins/Roslyn for air-gapped machines.","Retry on transient failures; treat persistent failure as a network/proxy issue."],"tags":["network","nuget","roslyn","install"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}