{"record":{"id":"61f83b4c0074ac44","repo":"moonD4rk/HackBrowserData","slug":"copy-s-w","errorCode":null,"errorMessage":"copy %s: %w","messagePattern":"copy (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"filemanager/session.go","lineNumber":65,"sourceCode":"\t\t// On other platforms, return the original error directly.\n\t\tif runtime.GOOS != \"windows\" {\n\t\t\treturn fmt.Errorf(\"copy: %w\", err)\n\t\t}\n\t\tif err2 := copyLocked(src, dst); err2 != nil {\n\t\t\treturn errors.Join(\n\t\t\t\tfmt.Errorf(\"copy: %w\", err),\n\t\t\t\tfmt.Errorf(\"locked copy: %w\", err2),\n\t\t\t)\n\t\t}\n\t}\n\n\t// Copy SQLite WAL/SHM companion files if present\n\tvar walErrs []error\n\tfor _, suffix := range []string{\"-wal\", \"-shm\"} {\n\t\twalSrc := src + suffix\n\t\tif isFileExists(walSrc) {\n\t\t\tif err := copyFile(walSrc, dst+suffix); err != nil {\n\t\t\t\twalErrs = append(walErrs, fmt.Errorf(\"copy %s: %w\", suffix, err))\n\t\t\t}\n\t\t}\n\t}\n\treturn errors.Join(walErrs...)\n}\n\n// Cleanup removes the session's temporary directory and all its contents.\nfunc (s *Session) Cleanup() {\n\tos.RemoveAll(s.tempDir)\n}\n","sourceCodeStart":47,"sourceCodeEnd":76,"githubUrl":"https://github.com/moonD4rk/HackBrowserData/blob/0503d04d7a8d0379d060268a74f1b149e5a0aad5/filemanager/session.go#L47-L76","documentation":"Acquire wraps failures copying SQLite WAL (-wal) or SHM (-shm) companion files with \"copy %s: %w\" (suffix is \"-wal\" or \"-shm\"). The main database copied fine, but copying its sidecar files failed, which can leave the staged database inconsistent — recent transactions living only in the WAL will be missing when the copy is opened.","triggerScenarios":"Session.Acquire(src, dst, false) on any platform where src+\"-wal\" or src+\"-shm\" exists but copyFile on it fails — typically the browser holds the WAL open with exclusive access, or the WAL is being rewritten/rotated mid-copy.","commonSituations":"Extracting Chrome/Edge cookies while the browser is running (WAL actively written); a checkpoint deleting the WAL between isFileExists and copyFile; permission differences between the main DB and sidecar files; destination write failures.","solutions":["Retry the acquisition — WAL sidecars are transient; after a checkpoint the main DB may be self-contained.","Close the browser first so the WAL is checkpointed and the sidecars become readable or disappear.","Treat the extracted copy as potentially stale if the WAL could not be copied: verify expected rows exist before decrypting.","Check disk space and destination writability for the dst+suffix files."],"exampleFix":"// before\nif err := s.Acquire(dbSrc, dbDst, false); err != nil {\n    return err\n}\n// after\nif err := s.Acquire(dbSrc, dbDst, false); err != nil {\n    log.Warnf(\"db copied with WAL/SHM issues (data may be stale): %v\", err)\n}","handlingStrategy":"fallback","validationCode":"// detect WAL sidecars and warn if the browser is live (copy may race)\nif _, err := os.Stat(src + \"-wal\"); err == nil {\n    log.Warnf(\"%s has an active WAL; close the browser for a consistent copy\", src)\n}","typeGuard":null,"tryCatchPattern":"// Go\nif err := s.Acquire(dbSrc, dbDst, false); err != nil {\n    if strings.Contains(err.Error(), \"copy -wal\") || strings.Contains(err.Error(), \"copy -shm\") {\n        log.Warnf(\"main db copied but sidecar copy failed; data may be stale: %v\", err)\n        return nil // continue with possibly-stale copy\n    }\n    return err\n}","preventionTips":["Close the browser first so SQLite checkpoints and removes WAL/SHM files","Retry if the WAL was rotated mid-copy","Verify expected record counts in the staged DB before decryption"],"tags":["sqlite","wal","file-copy","browser-lock"],"backgroundTag":"file-read-failed","analyzedSha":"0503d04d7a8d0379d060268a74f1b149e5a0aad5","analyzedAt":"2026-09-06T13:38:28.707Z","contentChangedAt":"2026-09-06T13:38:28.707Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}