{"record":{"id":"15029515b5663b39","repo":"syncthing/syncthing","slug":"dst-write-w","errorCode":null,"errorMessage":"dst write: %w","messagePattern":"dst write: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/model/folder_sendrecv.go","lineNumber":1513,"sourceCode":"\t}\n\n\tdstFd, err := state.tempFile()\n\tif err != nil {\n\t\t// State is already marked as failed when an error is returned here.\n\t\treturn false\n\t}\n\n\tif f.CopyRangeMethod != config.CopyRangeMethodStandard {\n\t\terr = f.withLimiter(ctx, func() error {\n\t\t\tdstFd.mut.Lock()\n\t\t\tdefer dstFd.mut.Unlock()\n\t\t\treturn fs.CopyRange(f.CopyRangeMethod.ToFS(), fd, dstFd.fd, srcOffset, block.Offset, int64(block.Size))\n\t\t})\n\t} else {\n\t\terr = f.limitedWriteAt(ctx, dstFd, buf, block.Offset)\n\t}\n\tif err != nil {\n\t\tstate.fail(fmt.Errorf(\"dst write: %w\", err))\n\t\treturn false\n\t}\n\treturn true\n}\n\nfunc (*sendReceiveFolder) verifyBuffer(buf []byte, block protocol.BlockInfo) error {\n\tif len(buf) != block.Size {\n\t\treturn fmt.Errorf(\"length mismatch %d != %d\", len(buf), block.Size)\n\t}\n\n\thash := sha256.Sum256(buf)\n\tif !bytes.Equal(hash[:], block.Hash) {\n\t\treturn fmt.Errorf(\"hash mismatch %x != %x\", hash, block.Hash)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":1495,"sourceCodeEnd":1531,"githubUrl":"https://github.com/syncthing/syncthing/blob/058bcd7334839663cf569501d3ac539034d45cb5/lib/model/folder_sendrecv.go#L1495-L1531","documentation":"While writing a copied block into the destination temp file (either via fs.CopyRange with a configured copy-range method, or limitedWriteAt which rate-limits a WriteAt), the write failed. This aborts the whole file pull for this pass; the temp file is kept so already-written blocks can be reused next attempt.","triggerScenarios":"copyBlock finisher: CopyRange fails (method unsupported on this filesystem — e.g. ioctl copy_file_range on overlayfs, or SPLICE/COPY_FILE_RANGE across incompatible mounts) or limitedWriteAt fails (ENOSPC disk full, EIO bad sector, EBADF fd closed because a previous failure finalized the temp file, or ctx cancelled mid-write).","commonSituations":"Disk full on the target; a copy-range method set globally (e.g. copy_file_range) that the folder's FS does not support; failing disk throwing I/O errors; file on a network mount that dropped.","solutions":["Check free space and disk health (df, dmesg for I/O errors) first","Set the copy range method back to 'standard' in advanced settings if a non-standard method is configured","Remount/repair flaky network filesystems (CIFS/NFS) hosting the folder","Re-run the sync — if the temp file is corrupt, delete .syncthing.*.tmp for that file to force a fresh pull"],"exampleFix":"// before: options { copyRangeMethod: \"copy_file_range\" } // fails on overlayfs\n// after:  options { copyRangeMethod: \"standard\" }","handlingStrategy":"fallback","validationCode":"// If you configure a copy-range method, verify it works on the folder fs first\nfunc copyRangeWorks(dir string, method config.CopyRangeMethod) bool {\n    // write two probe files and attempt fs.CopyRange once; true iff no error\n    // (omitted: mirrors folder_sendrecv copyBlock setup)\n    return probeCopyRange(dir, method) == nil\n}","typeGuard":null,"tryCatchPattern":"// Wrap block writes; on failure containing ENOSPC/EIO surface disk state\n// to the operator; on EBADF/ECANCELED discard the temp state and restart\n// the file pull from scratch.","preventionTips":["Leave copyRangeMethod 'standard' unless a method is verified on your fs","Monitor disk space before/while large syncs","Exclude .syncthing.*.tmp from cleanup jobs and AV"],"tags":["io","disk-full","copy-range","sync"],"backgroundTag":null,"analyzedSha":"058bcd7334839663cf569501d3ac539034d45cb5","analyzedAt":"2026-08-15T07:53:43.174Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}