{"record":{"id":"81035762f75a55c5","repo":"actualbudget/actual","slug":"file-does-not-exist-or-you-don-t-have-access-to-it","errorCode":null,"errorMessage":"File does not exist or you don't have access to it","messagePattern":"File does not exist or you don't have access to it","errorType":"exception","errorClass":"FileNotFound","httpStatus":null,"severity":"error","filePath":"packages/sync-server/src/app-sync/services/files-service.ts","lineNumber":142,"sourceCode":"  encrypt_meta: string | null;\n  encrypt_salt: string | null;\n  encrypt_test: string | null;\n  encrypt_keyid: string | null;\n  deleted: number;\n  owner: string | null;\n};\n\nclass FilesService {\n  accountDb: WrappedDatabase;\n\n  constructor(accountDb: WrappedDatabase) {\n    this.accountDb = accountDb;\n  }\n\n  get(fileId: FileId) {\n    const rawFile = this.getRaw(fileId);\n    if (!rawFile || (rawFile && rawFile.deleted)) {\n      throw new FileNotFound();\n    }\n\n    return this.validate(rawFile);\n  }\n\n  set(file: File) {\n    const deletedInt = boolToInt(file.deleted);\n    this.accountDb.mutate(\n      'INSERT INTO files (id, group_id, sync_version, name, encrypt_meta, encrypt_salt, encrypt_test, encrypt_keyid, deleted, owner) VALUES (?, ?, ?, ?, ?, ?, ?, ? ,?, ?)',\n      [\n        file.id,\n        file.groupId,\n        file.syncVersion?.toString(),\n        file.name,\n        file.encryptMeta,\n        file.encryptSalt,\n        file.encryptTest,\n        file.encryptKeyId,","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/sync-server/src/app-sync/services/files-service.ts#L124-L160","documentation":"FileNotFound is thrown by FilesService.get() when no row exists for the given fileId, or the row exists but is soft-deleted (deleted flag set). It is the canonical 'this file is not accessible to you' error of the app-sync files service.","triggerScenarios":"Any read path (verifyFileExists, sync handlers) calling get(fileId) with: an unknown ID, an ID belonging to another user after ownership validation, or a file that has been deleted (DELETE endpoint) but whose ID is still cached client-side.","commonSituations":"Client points at a different server/directory than where the budget was created; the budget file was deleted from another device; stale local metadata referencing an old group; database was reset or migrated.","solutions":["Verify the file ID / sync ID used by the client exists in the files table of the account database.","Confirm the client is talking to the correct sync server instance and uses the same user credentials.","If the file was deleted, create/upload the file again or restore it from a backup.","Clear stale local budget metadata and re-download or reset sync for that file."],"exampleFix":"// before\nawait client.getFile('dead-file-id');   // FileNotFound\n// after\nconst files = await client.listFiles();\nconst file = files.find(f => f.groupId === myGroupId);\nawait client.getFile(file.fileId);","handlingStrategy":"try-catch","validationCode":"// before fetching, confirm the id exists via list/find\nconst known = await client.listKnownFileIds?.() ?? [];\nif (!known.includes(fileId)) console.warn(`File ${fileId} not in server list`);","typeGuard":"function isFileNotFound(err: unknown): err is { type: 'file-not-found' } {\n  return typeof err === 'object' && err !== null && (err as any).type === 'file-not-found';\n}","tryCatchPattern":"try {\n  const file = filesService.get(fileId);\n  return file;\n} catch (err) {\n  if (isFileNotFound(err)) {\n    return null; // treat as deleted / never existed; prompt user to re-create or reset sync\n  }\n  throw err;\n}","preventionTips":["Refresh the client's file list after deletes on other devices.","Point the client at the correct server URL and user credentials.","Back up the account DB before resets to allow restoring deleted files.","Treat 404-like file errors as a signal to re-download budget metadata instead of retrying blindly."],"tags":["file-not-found","sync-server","http","rest"],"backgroundTag":"resource-not-found","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}