{"record":{"id":"10cad890b37d6554","repo":"ytdl-org/youtube-dl","slug":"file-locking-is-not-supported-on-this-platform","errorCode":null,"errorMessage":"file locking is not supported on this platform","messagePattern":"file locking is not supported on this platform","errorType":"exception","errorClass":"IOError","httpStatus":null,"severity":"error","filePath":"youtube_dl/utils.py","lineNumber":3547,"sourceCode":"        if not UnlockFileEx(handle, 0,\n                            whole_low, whole_high, f._lock_file_overlapped_p):\n            raise OSError('Unlocking file failed: %r' % ctypes.FormatError())\n\nelse:\n    # Some platforms, such as Jython, is missing fcntl\n    try:\n        import fcntl\n\n        def _lock_file(f, exclusive):\n            fcntl.flock(f, fcntl.LOCK_EX if exclusive else fcntl.LOCK_SH)\n\n        def _unlock_file(f):\n            fcntl.flock(f, fcntl.LOCK_UN)\n    except ImportError:\n        UNSUPPORTED_MSG = 'file locking is not supported on this platform'\n\n        def _lock_file(f, exclusive):\n            raise IOError(UNSUPPORTED_MSG)\n\n        def _unlock_file(f):\n            raise IOError(UNSUPPORTED_MSG)\n\n\nclass locked_file(object):\n    def __init__(self, filename, mode, encoding=None):\n        assert mode in ['r', 'a', 'w']\n        self.f = io.open(filename, mode, encoding=encoding)\n        self.mode = mode\n\n    def __enter__(self):\n        exclusive = self.mode != 'r'\n        try:\n            _lock_file(self.f, exclusive)\n        except IOError:\n            self.f.close()\n            raise","sourceCodeStart":3529,"sourceCodeEnd":3565,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/utils.py#L3529-L3565","documentation":"Error \"file locking is not supported on this platform\" thrown in ytdl-org/youtube-dl.","triggerScenarios":"Thrown at youtube_dl/utils.py:3547 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run on a platform/filesystem that supports file locking, or avoid concurrent runs."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}