{"record":{"id":"c89e1a6eccc5997a","repo":"LykosAI/StabilityMatrix","slug":"python-version-download-did-not-contain-expected-inner","errorCode":null,"errorMessage":"Python {version} download did not contain expected inner 'python' folder: {innerPythonDir}","messagePattern":"Python (.+?) download did not contain expected inner 'python' folder: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs","lineNumber":362,"sourceCode":"                );\n            }\n\n            // Extract\n            Logger.Info($\"Extracting Python {version} Zip: {downloadPath} to {pythonDir}\");\n            if (pythonDir.Exists)\n            {\n                await pythonDir.DeleteAsync(true);\n            }\n            progress?.Report(new ProgressReport(0, $\"Installing Python {version}\", isIndeterminate: true));\n            await ArchiveHelper.Extract7ZAuto(downloadPath, pythonDir);\n\n            // For Unix, move the inner 'python' folder up to the root PythonDir\n            if (Compat.IsUnix)\n            {\n                var innerPythonDir = pythonDir.JoinDir(\"python\");\n                if (!innerPythonDir.Exists)\n                {\n                    throw new Exception(\n                        $\"Python {version} download did not contain expected inner 'python' folder: {innerPythonDir}\"\n                    );\n                }\n\n                foreach (var folder in Directory.EnumerateDirectories(innerPythonDir))\n                {\n                    var folderName = Path.GetFileName(folder);\n                    var dest = Path.Combine(pythonDir, folderName);\n                    Directory.Move(folder, dest);\n                }\n                Directory.Delete(innerPythonDir);\n            }\n        }\n        finally\n        {\n            // Cleanup download file\n            if (File.Exists(downloadPath))\n            {","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs#L344-L380","documentation":"After extracting the Python archive on Unix, InstallPythonIfNecessary expects an inner 'python' folder inside the extraction target and moves its contents up to PythonDir. If that folder is missing the archive layout is not what the app expects, so a plain Exception is thrown with the checked path.","triggerScenarios":"The extracted python-{version} directory does not contain a top-level 'python' folder — extraction was interrupted/partial, the downloaded archive has a different layout, or the target pythonDir already contains stale/partial content.","commonSituations":"Disk full during extraction; leftover partial extraction from a previously failed install; app version expecting layout X but assets serving layout Y; user manually unpacked/modified the assets directory.","solutions":["Delete the python install directory under Assets and reinstall Python so extraction starts clean.","Re-download the archive (fix hash-mismatch/network issues first) so the correct layout is extracted.","Free disk space if extraction is being truncated.","Update Stability Matrix if the asset layout changed and the bundled extractor expects the old layout."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var inner = pythonDir.JoinDir(\"python\");\nif (!inner.Exists) { /* clean extraction dir and reinstall before proceeding */ Directory.Delete(pythonDir, true); }","typeGuard":null,"tryCatchPattern":"try { await helper.InstallPythonIfNecessary(version); }\ncatch (Exception ex) when (ex.Message.Contains(\"inner 'python' folder\"))\n{ Directory.Delete(pythonDir, true); await helper.InstallPythonIfNecessary(version); }","preventionTips":["Always start extraction from a clean target directory (remove stale python dirs).","Verify the archive hash first so broken downloads are never extracted.","Don't manually unpack or modify the assets python directory.","Keep enough free disk space for full extraction."],"tags":["python","extraction","archive-layout","unix","installation-failed"],"backgroundTag":"file-not-found","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"}