github/spec-kit · error · OSError
Failed to commit workflow file ({commit_exc}); failed to res
Error message
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}. What it means
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.
Source
Thrown at src/specify_cli/workflows/_commands.py:801
and os.path.samestat(placeholder_state, backup_state)
):
try:
backup_file.unlink(missing_ok=True)
except OSError:
pass
raise
try:
if isinstance(staged_file, _StagedWorkflowFile):
staged_file.verify_path()
# Windows cannot replace an open file. Verify through the
# exclusive descriptor, then close immediately before rename.
staged_file.close()
os.replace(staged_path, dest_file)
except BaseException as commit_exc:
try:
os.replace(backup_file, dest_file)
except OSError as restore_exc:
raise OSError(
f"Failed to commit workflow file ({commit_exc}); failed "
f"to restore the prior workflow from {backup_file} "
f"({restore_exc}). The prior workflow remains at "
f"{backup_file}."
) from restore_exc
raise
return backup_file
if isinstance(staged_file, _StagedWorkflowFile):
staged_file.verify_path()
staged_file.close()
os.replace(staged_path, dest_file)
return None
def _discard_staged_workflow_file(
staged_file: Path | _StagedWorkflowFile,
dest_dir: Path,
existed_before: bool,View on GitHub (pinned to bf88c9f9a8)
Solutions
- Manually restore the prior workflow from the reported backup file, then retry the operation.
When it happens
Trigger: Thrown at src/specify_cli/workflows/_commands.py:801 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of github/spec-kit@bf88c9f9a8 (2026-08-14).
Data as JSON: /api/errors/55b1a11b4e2bb0cc.
Report an issue: GitHub.