{"record":{"id":"44cf8d0f7d70bef1","repo":"LykosAI/StabilityMatrix","slug":"expected-sageattention-file-filename-was-not-found","errorCode":null,"errorMessage":"Expected SageAttention file '{fileName}' was not found.","messagePattern":"Expected SageAttention file '(.+?)' was not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs","lineNumber":256,"sourceCode":"        await venvRunner.PipInstall(AmdAiterWheelUrl).ConfigureAwait(false);\n\n        progress?.Report(\n            new ProgressReport(-1f, \"Installing Flash Attention for Windows ROCm...\", isIndeterminate: true)\n        );\n        await venvRunner.PipInstall(FlashAttentionWheelUrl).ConfigureAwait(false);\n    }\n\n    private async Task DownloadAndReplaceFileAsync(\n        DirectoryPath sageAttentionDir,\n        string fileName,\n        string sourceUrl,\n        IProgress<ProgressReport>? progress\n    )\n    {\n        var targetFile = sageAttentionDir.JoinFile(fileName);\n        if (!targetFile.Exists)\n        {\n            throw new FileNotFoundException(\n                $\"Expected SageAttention file '{fileName}' was not found.\",\n                targetFile.FullPath\n            );\n        }\n\n        var backupFile = sageAttentionDir.JoinFile($\"{fileName}.bak\");\n        if (!backupFile.Exists)\n        {\n            await backupFile\n                .WriteAllTextAsync(await targetFile.ReadAllTextAsync().ConfigureAwait(false))\n                .ConfigureAwait(false);\n        }\n\n        var tempFile = WorkingDirectory.JoinFile($\"sm-rocm-sage-{fileName}.tmp\");\n        await downloadService.DownloadToFileAsync(sourceUrl, tempFile, progress).ConfigureAwait(false);\n\n        try\n        {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs#L238-L274","documentation":"DownloadAndReplaceFileAsync expects the SageAttention wheel/source file (given by fileName) to already exist inside the package's SageAttention directory (sageAttentionDir). It joins the directory and file name, and if the file is absent throws FileNotFoundException including the full path. This happens after a download/extraction step should have placed the file, so its absence means an earlier step produced nothing at the expected path.","triggerScenarios":"ExecuteSageAttentionAsync calls DownloadAndReplaceFileAsync for an expected SageAttention artifact (e.g. a .whl or patch file) whose name was computed for the package, but the file is not present under sageAttentionDir when the existence check runs — typically because the upstream GitHub release asset was renamed, the download silently failed, or extraction put it in a different subfolder.","commonSituations":"Upstream SageAttention release changed asset file names so the hardcoded/computed fileName no longer matches; a proxy/firewall or GitHub outage left a zero-byte or missing file after the previous step; a cached/partial install from a failed prior run skipped the download step; the ROCm-specific wheel variant (e.g. torch 2.x + cu/rocm tags) does not exist so nothing matching was placed in the directory.","solutions":["Delete the package's SageAttention directory and rerun the Windows ROCm install step so the download runs fresh.","Compare the fileName in the exception to the actual files in the SageAttention directory; if upstream renamed assets, update the step's expected file name / download URL to the new asset name.","Verify the prior download step's logs for a failed or empty download (network/proxy issues) and retry on a working connection.","Manually download the expected SageAttention artifact from the upstream release and place it at the path in the exception message, then rerun.","Ensure the torch/CUDA-or-ROCm variant expected by the step actually has a published wheel; pick a package/torch version combination that does."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var targetFile = sageAttentionDir.JoinFile(fileName);\nif (!targetFile.Exists)\n{\n    logger.LogWarning(\"SageAttention artifact missing: {Path}\", targetFile.FullPath);\n    // re-run the download step or correct fileName before calling DownloadAndReplaceFileAsync\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await ExecuteSageAttentionAsync(dir, progress, ct);\n}\ncatch (FileNotFoundException ex)\n{\n    logger.LogError(ex, \"SageAttention file missing: {File}\", ex.FileName);\n    // remediate: wipe sageAttentionDir, re-download from upstream release, then retry once\n}","preventionTips":["Verify the expected asset names against the upstream SageAttention release before each release of the install step.","Always run the download step fresh (no skip-if-cached) when artifacts may have changed upstream.","Validate downloads by checking the file exists and is non-empty after each download step."],"tags":["file-not-found","download","sageattention","rocm","windows"],"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"}