{"record":{"id":"6a846ffc3196ee64","repo":"tailscale/tailscale","slug":"too-many-retries-trying-to-rename-q-to-q","errorCode":null,"errorMessage":"too many retries trying to rename %q to %q","messagePattern":"too many retries trying to rename %q to %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"feature/taildrop/fileops_fs.go","lineNumber":151,"sourceCode":"\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tsumD, err := sha256File(dst)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif bytes.Equal(sumP[:], sumD[:]) {\n\t\t\t\tif err := os.Remove(oldPath); err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t}\n\t\t\t\treturn dst, nil\n\t\t\t}\n\t\t}\n\n\t\t// Choose a new destination filename and try again.\n\t\tdst = filepath.Join(filepath.Dir(dst), nextFilename(filepath.Base(dst)))\n\t}\n\n\treturn \"\", fmt.Errorf(\"too many retries trying to rename %q to %q\", oldPath, newName)\n}\n\n// sha256File computes the SHA‑256 of a file.\nfunc sha256File(path string) (sum [sha256.Size]byte, _ error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn sum, err\n\t}\n\tdefer f.Close()\n\th := sha256.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn sum, err\n\t}\n\tcopy(sum[:], h.Sum(nil))\n\treturn sum, nil\n}\n\nfunc (f fsFileOps) ListFiles() ([]string, error) {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/feature/taildrop/fileops_fs.go#L133-L169","documentation":"Rename tried repeatedly to move the partial file to a unique final name, but every candidate name already existed with different contents, and the retry cap was hit. It means the Taildrop directory holds many files with the same base name.","triggerScenarios":"Thrown at feature/taildrop/fileops_fs.go:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clear old copies of the file from the Taildrop directory.","Send the file with a different name."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}