{"record":{"id":"c8a84d67a6703838","repo":"immich-app/immich","slug":"skipping-move-due-to-file-size-mismatch","errorCode":null,"errorMessage":"Skipping move due to file size mismatch","messagePattern":"Skipping move due to file size mismatch","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/cores/storage.core.ts","lineNumber":256,"sourceCode":"      return;\n    }\n\n    if (move.oldPath !== newPath) {\n      try {\n        this.logger.debug(`Attempting to rename file: ${move.oldPath} => ${newPath}`);\n        await this.storageRepository.rename(move.oldPath, newPath);\n      } catch (error: any) {\n        if (error.code !== 'EXDEV') {\n          this.logger.warn(\n            `Unable to complete move. Error renaming file with code ${error.code} and message: ${error.message}`,\n          );\n          return;\n        }\n        this.logger.debug(`Unable to rename file. Falling back to copy, verify and delete`);\n        await this.storageRepository.copyFile(move.oldPath, newPath);\n\n        if (!(await this.verifyNewPathContentsMatchesExpected(move.oldPath, newPath, assetInfo))) {\n          this.logger.warn(`Skipping move due to file size mismatch`);\n          await this.storageRepository.unlink(newPath);\n          return;\n        }\n\n        const { atime, mtime } = await this.storageRepository.stat(move.oldPath);\n        await this.storageRepository.utimes(newPath, atime, mtime);\n\n        try {\n          await this.storageRepository.unlink(move.oldPath);\n        } catch (error: any) {\n          this.logger.warn(`Unable to delete old file, it will now no longer be tracked by Immich: ${error.message}`);\n        }\n      }\n    }\n\n    await this.savePath(pathType, entityId, newPath, ownerId);\n    await this.moveRepository.delete(move.id);\n  }","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/cores/storage.core.ts#L238-L274","documentation":"When a direct rename across filesystems fails, moveFile falls back to copy-verify-delete. If the copied file's size does not match the expected size, the move is deliberately skipped: the new file is unlinked and the original is left in place, and only a warning is logged.","triggerScenarios":"moveFile (via moveAssetImage/moveAssetVideo/movePersonFile) falls back to copyFile because rename failed, and verifyNewPathContentsMatchesExpected returns false because newPath size differs from oldStat.size (or assetInfo.sizeInBytes).","commonSituations":"Copy interrupted or source file changed/truncated mid-copy; partially failed disk; source file modified between stat and copy; storage backend reports wrong sizes (some network mounts).","solutions":["Retry the move after confirming the source file is stable","Check disk health and free space on the destination volume","Verify the source file is not being written by another process during the move","Investigate the storage backend's copyFile implementation for silent truncation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const oldStat = await fs.promises.stat(oldPath);\nconst newStat = await fs.promises.stat(newPath);\nif (newStat.size !== oldStat.size) { await fs.promises.unlink(newPath); return false; }","typeGuard":null,"tryCatchPattern":"const moved = await storageCore.moveFile(type, id, newPath);\nif (!moved) {\n  logger.warn('move skipped; original file retained at ' + oldPath);\n  scheduleRetry(oldPath, newPath);\n}","preventionTips":["Quiesce sync/upload jobs during bulk moves","Monitor free space on destination volumes","Alert on 'Skipping move due to file size mismatch' warnings — original stays in place","Ensure source files are fully written before moving"],"tags":["filesystem","file-move","verification","immich"],"backgroundTag":"checksum-mismatch","analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}