From dbe34f80bf16bafa61ef46bb8fed1a075ea447e3 Mon Sep 17 00:00:00 2001 From: agent932 Date: Fri, 12 Jun 2026 17:51:56 -0400 Subject: [PATCH] fix: replace renameSync with copyFileSync+unlinkSync in modelRegistryStore renameSync fails with EBUSY (errno -16) on Linux when the target file is held open by another process or on certain bind mount configurations. copyFileSync + unlinkSync achieves the same atomic-write intent without triggering the lock condition. Fixes model save failure on Linux Docker deployments. --- backend/src/utils/modelRegistryStore.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/utils/modelRegistryStore.ts b/backend/src/utils/modelRegistryStore.ts index 6458efb..5ba9435 100644 --- a/backend/src/utils/modelRegistryStore.ts +++ b/backend/src/utils/modelRegistryStore.ts @@ -302,7 +302,8 @@ function writeProfileRegistry(registry: ModelRegistry): void { const profilePath = getModelRegistryPath(); fs.mkdirSync(path.dirname(profilePath), { recursive: true }); fs.writeFileSync(`${profilePath}.tmp`, `${JSON.stringify(registry, null, 2)}\n`, "utf-8"); - fs.renameSync(`${profilePath}.tmp`, profilePath); + fs.copyFileSync(`${profilePath}.tmp`, profilePath); + fs.unlinkSync(`${profilePath}.tmp`); } function registryFromEnvJson(env: Record): ModelRegistry {