{"record":{"id":"73bc6d6712e62d14","repo":"github/spec-kit","slug":"failed-to-write-staged-workflow-file","errorCode":null,"errorMessage":"Failed to write staged workflow file","messagePattern":"Failed to write staged workflow file","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/workflows/_commands.py","lineNumber":578,"sourceCode":"    return dest_dir\n\n\nclass _StagedWorkflowFile:\n    \"\"\"Exclusive staging inode kept open until its atomic commit.\"\"\"\n\n    def __init__(self, path: Path, fd: int) -> None:\n        self.path = path\n        self.fd = fd\n\n    def _write(self, chunks) -> None:\n        os.lseek(self.fd, 0, os.SEEK_SET)\n        os.ftruncate(self.fd, 0)\n        for chunk in chunks:\n            view = memoryview(chunk)\n            while view:\n                written = os.write(self.fd, view)\n                if written <= 0:\n                    raise OSError(\"Failed to write staged workflow file\")\n                view = view[written:]\n\n    def write_bytes(self, data: bytes) -> None:\n        self._write((data,))\n\n    def verify_path(self) -> None:\n        import stat\n\n        try:\n            path_stat = self.path.stat(follow_symlinks=False)\n            open_stat = os.fstat(self.fd)\n        except OSError as exc:\n            raise OSError(\n                \"Staged workflow file changed before commit\"\n            ) from exc\n        if (\n            not stat.S_ISREG(path_stat.st_mode)\n            or path_stat.st_dev != open_stat.st_dev","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/workflows/_commands.py#L560-L596","documentation":"Error \"Failed to write staged workflow file\" thrown in github/spec-kit.","triggerScenarios":"Thrown at src/specify_cli/workflows/_commands.py:578 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check filesystem permissions and free space on the staging directory, then retry."],"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-15T17:31:12.345Z"}