{"record":{"id":"b489422b4d6c2f17","repo":"actualbudget/actual","slug":"could-not-resolve-on-disk-budget-id-for-syncid-s","errorCode":null,"errorMessage":"Could not resolve on-disk budget id for syncId ${syncId} after download.","messagePattern":"Could not resolve on-disk budget id for syncId (.+?) after download\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/connection.ts","lineNumber":33,"sourceCode":"\ntype ConnectionOptions = {\n  mutates: boolean;\n  skipBudget?: boolean;\n};\n\nfunction info(message: string, verbose?: boolean) {\n  if (verbose) process.stderr.write(message + '\\n');\n}\n\nasync function resolveBudgetIdForSyncId(syncId: string): Promise<string> {\n  const budgets = await api.getBudgets();\n  const match = budgets.find(\n    b =>\n      typeof b.id === 'string' &&\n      (b.groupId === syncId || b.cloudFileId === syncId),\n  );\n  if (!match?.id) {\n    throw new Error(\n      `Could not resolve on-disk budget id for syncId ${syncId} after download.`,\n    );\n  }\n  return match.id;\n}\n\nexport async function withConnection<T>(\n  globalOpts: CliGlobalOpts,\n  fn: (config: CliConfig) => Promise<T>,\n  { mutates, skipBudget = false }: ConnectionOptions,\n): Promise<T> {\n  const config = await resolveConfig(globalOpts);\n\n  info(`Connecting to ${config.serverUrl}...`, globalOpts.verbose);\n\n  if (config.sessionToken) {\n    await api.init({\n      serverURL: config.serverUrl,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/cli/src/connection.ts#L15-L51","documentation":"resolveBudgetIdForSyncId maps a sync/cloud identifier (groupId or cloudFileId) to a local on-disk budget id. After downloading the budget from the server it lists known budgets and looks for one whose groupId or cloudFileId matches the syncId. If no local budget file matches even after download, the mapping failed and this error is thrown.","triggerScenarios":"Calling a command with --sync-id (or ACTUAL_SYNC_ID) whose value matches no budget in the data dir: wrong syncId, budget deleted locally after download failed, or dataDir pointing at the wrong directory.","commonSituations":"Copying a syncId from an old server export; pointing --data-dir at a fresh empty directory; budget deleted on another device before the local download completed; typo'd syncId.","solutions":["Verify the syncId against the server (budget settings / sync id) and correct the --sync-id value.","Check --data-dir points to the directory that actually holds your budget files.","Re-run the command — a transient download failure can leave no local file; a retry can fix it.","List locally available budgets (budgets command) and use the correct id/group."],"exampleFix":"// before\nactual-cli accounts --sync-id 8f2c...wrong\n// after\nactual-cli accounts --sync-id 8f2c...correct-sync-id","handlingStrategy":"try-catch","validationCode":"import { getBudgets } from '@actual-app/api';\nconst budgets = await getBudgets();\nconst match = budgets.find(b => b.groupId === syncId || b.cloudFileId === syncId);\nif (!match) throw new Error(`syncId ${syncId} not present locally; check --data-dir or re-download.`);","typeGuard":"function resolvesToBudget(budgets: { id: unknown; groupId?: string; cloudFileId?: string }[], syncId: string): boolean {\n  return budgets.some(b => typeof b.id === 'string' && (b.groupId === syncId || b.cloudFileId === syncId));\n}","tryCatchPattern":"try {\n  await withConnection(config, async () => { /* ... */ });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Could not resolve on-disk budget id')) {\n    console.error(`Sync id ${syncId} has no local budget. Verify --sync-id and --data-dir, then retry.`);\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Copy the sync id directly from the budget's settings page instead of typing it.","Pin --data-dir to the directory used by previous successful runs.","Retry once on this error — the preceding download may have failed transiently.","List budgets on disk after failures to see what actually downloaded."],"tags":["sync","budget","cli","network"],"backgroundTag":"budget-sync-id-not-found","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}