{"record":{"id":"55b1a11b4e2bb0cc","repo":"github/spec-kit","slug":"failed-to-commit-workflow-file-commit-exc-fai","errorCode":null,"errorMessage":"Failed to commit workflow file ({commit_exc}); failed to restore the prior workflow from {backup_file} ({restore_exc}). The prior workflow remains at {backup_file}.","messagePattern":"Failed to commit workflow file \\((.+?)\\); failed to restore the prior workflow from (.+?) \\((.+?)\\)\\. The prior workflow remains at (.+?)\\.","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/workflows/_commands.py","lineNumber":801,"sourceCode":"                and os.path.samestat(placeholder_state, backup_state)\n            ):\n                try:\n                    backup_file.unlink(missing_ok=True)\n                except OSError:\n                    pass\n            raise\n        try:\n            if isinstance(staged_file, _StagedWorkflowFile):\n                staged_file.verify_path()\n                # Windows cannot replace an open file. Verify through the\n                # exclusive descriptor, then close immediately before rename.\n                staged_file.close()\n            os.replace(staged_path, dest_file)\n        except BaseException as commit_exc:\n            try:\n                os.replace(backup_file, dest_file)\n            except OSError as restore_exc:\n                raise OSError(\n                    f\"Failed to commit workflow file ({commit_exc}); failed \"\n                    f\"to restore the prior workflow from {backup_file} \"\n                    f\"({restore_exc}). The prior workflow remains at \"\n                    f\"{backup_file}.\"\n                ) from restore_exc\n            raise\n        return backup_file\n    if isinstance(staged_file, _StagedWorkflowFile):\n        staged_file.verify_path()\n        staged_file.close()\n    os.replace(staged_path, dest_file)\n    return None\n\n\ndef _discard_staged_workflow_file(\n    staged_file: Path | _StagedWorkflowFile,\n    dest_dir: Path,\n    existed_before: bool,","sourceCodeStart":783,"sourceCodeEnd":819,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/workflows/_commands.py#L783-L819","documentation":"Error \"Failed to commit workflow file ({commit_exc}); failed to restore the prior workflow from {backup_file} ({restore_exc}). The prior workflow remains at {backup_file}.\" thrown in github/spec-kit.","triggerScenarios":"Thrown at src/specify_cli/workflows/_commands.py:801 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Manually restore the prior workflow from the reported backup file, then retry the operation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}