{"record":{"id":"949c63fc3ed4e4ca","repo":"shadcn-ui/ui","slug":"failed-to-sync-linked-workspace-configs-error-m","errorCode":null,"errorMessage":"Failed to sync linked workspace configs. ${error.message}","messagePattern":"Failed to sync linked workspace configs\\. (.+?)","errorType":"exception","errorClass":"ApplyWorkspaceSyncError","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/commands/apply.ts","lineNumber":513,"sourceCode":"          ...patch,\n          tailwind: {\n            ...workspaceConfig.existingConfig.tailwind,\n            ...patch.tailwind,\n          },\n        },\n        { spaces: 2 }\n      )\n    }\n\n    for (const workspaceConfig of workspaceConfigs) {\n      deleteFileBackup(workspaceConfig.configPath)\n    }\n  } catch (error) {\n    for (const workspaceConfig of [...workspaceConfigs].reverse()) {\n      restoreFileBackup(workspaceConfig.configPath)\n    }\n\n    throw new ApplyWorkspaceSyncError(\n      `Failed to sync linked workspace configs.${error instanceof Error ? ` ${error.message}` : \"\"}`\n    )\n  }\n}\n\nasync function getApplyWorkspaceConfigs(config: Config) {\n  const workspaceConfig = await getWorkspaceConfig(config)\n  if (!workspaceConfig) {\n    return []\n  }\n\n  const linkedConfigs = new Map<string, Config>()\n\n  for (const linkedConfig of Object.values(workspaceConfig)) {\n    if (linkedConfig.resolvedPaths.cwd === config.resolvedPaths.cwd) {\n      continue\n    }\n","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/commands/apply.ts#L495-L531","documentation":"Wrap-around error thrown at the end of the apply workspace-sync catch block. Any exception inside the sync try — a FileBackupError (#20), fs.writeJson failing with ENOSPC/EACCES, or JSON serialization failure — triggers restoreFileBackup for every workspace in reverse order, then rethrows as ApplyWorkspaceSyncError with the original cause appended.","triggerScenarios":"Any exception raised inside apply.ts:482-507 during linked-workspace config sync. The appended `error.message` identifies the underlying cause: disk full (ENOSPC), permission denied writing a workspace components.json, or a FileBackupError from #20.","commonSituations":"Disk full mid-write, one linked workspace on a network mount that drops, components.json made read-only after the initial readJson, partial state from a previous crashed apply, monorepo with one package on a clean git checkout (read-only).","solutions":["Read the original cause after the period in the message — it tells you which workspace and why.","Free disk space on the volume holding the linked workspaces (ENOSPC).","Check write permissions on every workspace's components.json, not just the root.","Verify each linked workspace path declared in components.json still exists and is writable.","If the rollback did not complete, manually restore each components.json from its components.json.bak."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before apply: assert every workspace config path is writable, not just root.\nimport fs from \"fs-extra\"\n\nasync function preflightWorkspaceWrite(configPaths: string[]) {\n  for (const p of configPaths) {\n    await fs.access(p, fs.constants.W_OK)\n  }\n}","typeGuard":"function isApplyWorkspaceSyncError(e: unknown): e is Error {\n  return e instanceof Error && e.name === \"ApplyWorkspaceSyncError\"\n}","tryCatchPattern":"try {\n  await applyToWorkspaces(config)\n} catch (e) {\n  if (isApplyWorkspaceSyncError(e)) {\n    // The underlying cause is appended after the period in e.message.\n    // Backups were already restored in reverse; verify each config:\n    for (const p of workspaceConfigPaths) {\n      const bak = `${p}.bak`\n      if (await fs.pathExists(bak)) await fs.move(bak, p, { overwrite: true })\n    }\n  }\n  throw e\n}","preventionTips":["Keep linked workspaces on the same writable volume as the root.","Run apply from the monorepo root with all packages checked out writable.","Confirm disk space and write access before running apply in CI."],"tags":["filesystem","monorepo","sync","rollback","apply"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}