{"record":{"id":"aca73cee04ca3699","repo":"LykosAI/StabilityMatrix","slug":"pip-index-failed-with-code-result-exitcode-result-aca73c","errorCode":null,"errorMessage":"pip index failed with code {result.ExitCode}: {result.StandardOutput}, {result.StandardError}","messagePattern":"pip index failed with code (.+?): (.+?), (.+?)","errorType":"exception","errorClass":"ProcessException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Python/UvVenvRunner.cs","lineNumber":467,"sourceCode":"        var noMatchingDistribution =\n            result.StandardOutput?.Contains(\n                \"No matching distribution found\",\n                StringComparison.OrdinalIgnoreCase\n            ) == true\n            || result.StandardError?.Contains(\n                \"No matching distribution found\",\n                StringComparison.OrdinalIgnoreCase\n            ) == true;\n\n        if (noMatchingDistribution || string.IsNullOrWhiteSpace(result.StandardOutput))\n        {\n            return null;\n        }\n\n        // Check return code\n        if (result.ExitCode != 0)\n        {\n            throw new ProcessException(\n                $\"pip index failed with code {result.ExitCode}: {result.StandardOutput}, {result.StandardError}\"\n            );\n        }\n\n        return PipIndexResult.Parse(result.StandardOutput);\n    }\n\n    /// <summary>\n    /// Run a custom install command. Waits for the process to exit.\n    /// workingDirectory defaults to RootPath.\n    /// </summary>\n    public async Task CustomInstall(ProcessArgs args, Action<ProcessOutput>? outputDataReceived = null)\n    {\n        // Record output for errors\n        var output = new StringBuilder();\n\n        var outputAction =\n            outputDataReceived == null","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Python/UvVenvRunner.cs#L449-L485","documentation":"UvVenvRunner.PipIndex runs `python -m pip index versions <pkg>` and throws this ProcessException when the process exits non-zero and the output does not contain the handled \"No matching distribution found\" marker (or an empty stdout, both of which return null instead). It surfaces pip's own stdout/stderr so the caller can see the real failure — typically a network/index problem rather than a missing package.","triggerScenarios":"Calling PipIndex(packageName, indexUrl, includePrerelease) where pip exits non-zero for reasons other than no-matching-distribution: unreachable or misconfigured --index-url (bad URL, auth required), SSL/proxy failures, or pip itself failing to start inside the venv.","commonSituations":"Custom index URL typo or expired credentials; corporate proxy blocking PyPI; self-signed certificate failures; network outage; index URL pointing at a non-PEP-503 endpoint.","solutions":["Inspect the StandardOutput/StandardError in the message to identify pip's actual complaint.","Verify network connectivity to the index URL and correct any URL/auth mistakes in the indexUrl argument.","Test `python -m pip index versions <pkg> --index-url <url>` manually in the same venv.","Fix proxy/SSL configuration (set HTTPS_PROXY, trusted-host, or corporate certs) and retry."],"exampleFix":"// before: treating every PipIndex failure as 'package not available'\nvar versions = await runner.PipIndex(pkg, indexUrl);\n// after: distinguish null (no versions) from a pip/network failure\nPipIndexResult? versions;\ntry { versions = await runner.PipIndex(pkg, indexUrl); }\ncatch (ProcessException ex) {\n    Logger.Error($\"pip index failed (network/index?): {ex.Message}\");\n    throw;\n}","handlingStrategy":"try-catch","validationCode":"// probe index reachability before PipIndex\nusing var http = new HttpClient();\nvar ok = (await http.GetAsync(indexUrl ?? \"https://pypi.org/simple/\")).IsSuccessStatusCode;","typeGuard":null,"tryCatchPattern":"try { versions = await runner.PipIndex(pkg, indexUrl); }\ncatch (ProcessException ex) { /* network/index issue; inspect ex.Message */ retry.WithBackoff(); }","preventionTips":["Validate indexUrl format and credentials before passing it.","Configure proxy/SSL (HTTPS_PROXY, trusted-host) for corporate networks.","Distinguish null (no versions) from ProcessException (query failed)."],"tags":["python","pip","network","package-index"],"backgroundTag":"http-error-response","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}