{"record":{"id":"60a2fc932b05f0e6","repo":"actualbudget/actual","slug":"getmodifiedtime-not-supported-on-the-web-only-use","errorCode":null,"errorMessage":"getModifiedTime not supported on the web (only used for backups)","messagePattern":"getModifiedTime not supported on the web \\(only used for backups\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/loot-core/src/platform/server/fs/index.ts","lineNumber":454,"sourceCode":"  if (await exists(dirpath)) {\n    for (const file of await listDir(dirpath)) {\n      const fullpath = join(dirpath, file);\n      // `true` here means to not follow symlinks\n      const attr = FS.stat(fullpath, true);\n\n      if (FS.isDir(attr.mode)) {\n        await removeDirRecursively(fullpath);\n      } else {\n        await removeFile(fullpath);\n      }\n    }\n\n    await removeDir(dirpath);\n  }\n};\n\nexport const getModifiedTime = async (_filepath: string): Promise<Date> => {\n  throw new Error(\n    'getModifiedTime not supported on the web (only used for backups)',\n  );\n};\n","sourceCodeStart":436,"sourceCodeEnd":458,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/loot-core/src/platform/server/fs/index.ts#L436-L458","documentation":"The web build of the server `fs` module cannot stat files for modification times because IndexedDB has no metadata API. `getModifiedTime` is intentionally unimplemented and always throws; it exists only to satisfy the fs type interface and is used solely for the backup feature.","triggerScenarios":"Calling `getModifiedTime(filepath)` in the browser build — directly or via backup-scheduling code that checks file mtimes.","commonSituations":"Shared code written against the node/electron fs running in the web build; a plugin or custom integration attempting to inspect file timestamps client-side.","solutions":["Only use getModifiedTime on node/electron builds; gate the call on platform","Track mtimes yourself (store a timestamp when you write the file via _writeFile) instead of asking the fs","If you need it on web, patch the module to return a stored metadata timestamp — but the upstream API intentionally does not support it"],"exampleFix":"// before\nconst mtime = await fs.getModifiedTime(path);\n// after\nlet mtime = null;\nif (typeof window === 'undefined') {\n  mtime = await fs.getModifiedTime(path);\n}","handlingStrategy":"fallback","validationCode":"const supportsMtime = typeof window === 'undefined'; // web build always throws\nif (!supportsMtime) console.warn('getModifiedTime unavailable on web');","typeGuard":null,"tryCatchPattern":"try {\n  mtime = await fs.getModifiedTime(path);\n} catch (e) {\n  if (String(e).includes('getModifiedTime not supported on the web')) {\n    mtime = fallbackMtimeFromMetadata(path); // stored timestamp at write time\n  } else throw e;\n}","preventionTips":["Gate backup/mtime logic behind a platform check","Record your own timestamps when writing files if you later need mtimes","Do not call backup-scheduling code paths in the web build"],"tags":["fs","web","not-implemented","backups"],"backgroundTag":"api-not-supported-on-platform","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}