{"record":{"id":"9a884a0a1759b300","repo":"OpenBB-finance/OpenBB","slug":"another-build-process-is-running-and-has-locked-s","errorCode":null,"errorMessage":"Another build process is running and has locked {self._lock_path}","messagePattern":"Another build process is running and has locked (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/core/openbb_core/app/static/package_builder.py","lineNumber":224,"sourceCode":"                    if self.lint:\n                        self._run_linters()\n                except BaseException as e:\n                    if not isinstance(e, (KeyboardInterrupt, SystemExit)):\n                        self.console.error(\"\\nBuild failed!\")  # type: ignore  # pylint: disable=E1101\n                        self.console.error(f\"Error: {e}\")  # type: ignore  # pylint: disable=E1101\n                        self.console.error(traceback.format_exc())  # type: ignore  # pylint: disable=E1101\n                        self.console.error(\"\\nInstruction:\")  # type: ignore  # pylint: disable=E1101\n                        self.console.error(  # type: ignore  # pylint: disable=E1101\n                            \"Set OPENBB_DEBUG_MODE='true' environment variable and run \"\n                            \"'openbb-build' again to see verbose output.\"\n                        )\n                    self._clean(modules)\n                    raise\n                finally:\n                    if hasattr(signal, \"SIGTERM\"):\n                        signal.signal(signal.SIGTERM, original_sigterm)\n            except BlockingIOError:\n                raise RuntimeError(  # noqa # pylint: disable=W0707\n                    f\"Another build process is running and has locked {self._lock_path}\"\n                )\n            finally:\n                # Release the file lock, suppressing any exceptions during cleanup\n                with contextlib.suppress(Exception):\n                    file_lock.release()\n\n    def _clean(self, modules: str | list[str] | None = None) -> None:\n        \"\"\"Delete the assets and package folder or modules before building.\"\"\"\n        shutil.rmtree(self.directory / \"assets\", ignore_errors=True)\n        if modules:\n            for module in modules:\n                module_path = self.directory / \"package\" / f\"{module}.py\"\n                if module_path.exists():\n                    module_path.unlink()\n        else:\n            shutil.rmtree(self.directory / \"package\", ignore_errors=True)\n","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/core/openbb_core/app/static/package_builder.py#L206-L242","documentation":"PackageBuilder._run raises this RuntimeError when acquiring its exclusive file lock raises BlockingIOError, meaning another openbb-build process already holds the lock at self._lock_path. The lock serializes static-asset builds so two concurrent builds cannot corrupt the generated package tree.","triggerScenarios":"Running 'openbb-build' (or openbb.build()) twice concurrently: a previous build still running in another terminal, a build left behind by an IDE task, or a stale lock file held by a zombie process. Also happens when a build is triggered on import while another interpreter session is mid-build.","commonSituations":"Two terminal windows both running openbb-build; CI jobs sharing a container workspace hitting the same lock file; a crashed build whose process still holds the flock; Docker builds where a long build in one layer overlaps the next.","solutions":["Wait for the running build to finish, then re-run openbb-build","Find and stop the other process: ps aux | grep openbb-build / lsof <lock_path>, then kill it","If no other process exists (stale holder died), remove the stale lock file and retry","In CI, serialize build steps so only one job builds at a time"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import os\n\nLOCK = os.path.expanduser('~/.openbb_platform/lock')\ndef lock_free(path: str = LOCK) -> bool:\n    try:\n        f = open(path, 'a+')\n        import fcntl\n        fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)\n        fcntl.flock(f, fcntl.LOCK_UN)\n        f.close()\n        return True\n    except (BlockingIOError, OSError):\n        return False","typeGuard":null,"tryCatchPattern":"import time\nfor attempt in range(3):\n    try:\n        from openbb import obb  # may trigger build\n        break\n    except RuntimeError as e:\n        if 'locked' not in str(e):\n            raise\n        time.sleep(30 * (attempt + 1))  # wait for the other build\nelse:\n    raise RuntimeError('openbb build stayed locked')","preventionTips":["Never run two openbb-build processes in the same environment simultaneously","Serialize build steps in CI (single job or explicit dependencies)","Kill leftover build processes before rebuilding: lsof + kill"],"tags":["openbb","build","concurrency","file-lock"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}