{"record":{"id":"b584748a4a2ec19a","repo":"chenhg5/cc-connect","slug":"write-w","errorCode":null,"errorMessage":"write: %w","messagePattern":"write: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/update.go","lineNumber":420,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != 200 {\n\t\treturn \"\", fmt.Errorf(\"download returned HTTP %d\", resp.StatusCode)\n\t}\n\n\ttmp, err := os.CreateTemp(\"\", \"cc-connect-update-*\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsize, err := io.Copy(tmp, resp.Body)\n\tif err != nil {\n\t\ttmp.Close()\n\t\tos.Remove(tmp.Name())\n\t\treturn \"\", fmt.Errorf(\"write: %w\", err)\n\t}\n\ttmp.Close()\n\n\tfmt.Printf(\"Downloaded %.1f MB\\n\", float64(size)/1024/1024)\n\treturn tmp.Name(), nil\n}\n\nfunc replaceExecutable(target, src string) error {\n\tif err := os.Chmod(src, 0o755); err != nil {\n\t\treturn fmt.Errorf(\"chmod: %w\", err)\n\t}\n\n\t// On Windows, rename over a running exe is not possible directly.\n\t// Move old binary aside, then move new one in.\n\tbackup := target + \".old\"\n\tos.Remove(backup)\n\n\tif err := os.Rename(target, backup); err != nil {","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/update.go#L402-L438","documentation":"Raised when io.Copy fails writing the downloaded release body into the temp file — typically disk full, temp dir unwritable, or the connection dropped mid-transfer. The partially written temp file is closed and removed before returning.","triggerScenarios":"Thrown at cmd/cc-connect/update.go:420 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the update — interrupted downloads are cleaned up automatically","Stabilize network connectivity for large binary downloads","Disable bandwidth-throttling proxies if present"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}