opensafely-core / opensafely-core/opensafely-cli
Provide more helpful errors when encountering locked files on Windows
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2
- Forks
- 5
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 4
Description
If a Windows user has a file open and then runs either a job via opensafely run this file then they will get an error. We've had a couple of reports of this (see below) but given how easy it is to do I'd be surprised if it wasn't happening more frequently than we hear about.
It's possible that there something we can do to work around this problem (maybe involving moving files around) but if we can't fix it we should at least raise a helpful error which explains what the issue is.
Note that the same problem can also occur when running ad-hoc commands via opensafely exec. However there's no general fix we can apply here (either to work around the issue or raise better errors) because it's up the individual action image to handle this (see e.g. this issue for ehrQL).
Here are a couple of cases where users have reported this issue:
- https://bennettoxford.slack.com/archives/C069YDR4NCA/p1751636334737689?thread_ts=1751636286.824579&cid=C069YDR4NCA
- https://bennettoxford.slack.com/archives/C069YDR4NCA/p1772550756823869?thread_ts=1772550751.713159&cid=C069YDR4NCA
Note these are also related to #347 because the issue is compounded by the unhelpful and false suggestion that it's been reported to tech support.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the locked-file failure through the opensafely run entry point on Windows, then inspect how the CLI reports that error. Compare whether files can be moved safely or whether a clearer message is possible; done means locked files produce a helpful explanation, while opensafely exec remains out of scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100