{"record":{"id":"33358b477b068a20","repo":"AlistGo/alist","slug":"failed-get-status-wrong-gid-s","errorCode":null,"errorMessage":"failed get status, wrong gid: %s","messagePattern":"failed get status, wrong gid: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/offline_download/transmission/client.go","lineNumber":144,"sourceCode":"\terr = t.client.TorrentRemove(context.TODO(), transmissionrpc.TorrentRemovePayload{\n\t\tIDs:             []int64{gid},\n\t\tDeleteLocalData: false,\n\t})\n\treturn err\n}\n\nfunc (t *Transmission) Status(task *tool.DownloadTask) (*tool.Status, error) {\n\tgid, err := strconv.ParseInt(task.GID, 10, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinfos, err := t.client.TorrentGetAllFor(context.TODO(), []int64{gid})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(infos) < 1 {\n\t\treturn nil, fmt.Errorf(\"failed get status, wrong gid: %s\", task.GID)\n\t}\n\tinfo := infos[0]\n\n\ts := &tool.Status{\n\t\tCompleted: *info.IsFinished,\n\t\tErr:       err,\n\t}\n\ts.Progress = *info.PercentDone * 100\n\ts.TotalBytes = int64(*info.SizeWhenDone / 8)\n\n\tswitch *info.Status {\n\tcase transmissionrpc.TorrentStatusCheckWait,\n\t\ttransmissionrpc.TorrentStatusDownloadWait,\n\t\ttransmissionrpc.TorrentStatusCheck,\n\t\ttransmissionrpc.TorrentStatusDownload,\n\t\ttransmissionrpc.TorrentStatusIsolated:\n\t\ts.Status = \"[transmission] \" + info.Status.String()\n\tcase transmissionrpc.TorrentStatusSeedWait,","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/offline_download/transmission/client.go#L126-L162","documentation":"Transmission.Status() parses the numeric GID and calls TorrentGetAllFor; transmission returns an empty result set (not an error) when no torrent with that id exists. The tool then reports 'wrong gid', meaning the torrent was deleted from the daemon or the id never belonged to this daemon.","triggerScenarios":"Polling a task after the torrent was removed in transmission's UI or by another client; daemon restarted with its torrent list lost; task GID from a different transmission instance (endpoint changed in settings).","commonSituations":"Users cleaning transmission's list while OpenList still tracks the task; transmission data dir wiped or moved; configuration pointing the tool at a new daemon with old task records.","solutions":["Treat this as terminal: delete the local task record, the remote torrent is gone","Re-add the torrent/magnet to create a fresh task with a new GID","After changing the transmission endpoint, clear stale offline task records"],"exampleFix":"// before\ninfos, _ := t.client.TorrentGetAllFor(ctx, []int64{gid})\nif len(infos) < 1 { return nil, fmt.Errorf(\"failed get status, wrong gid: %s\", task.GID) }\n\n// caller: terminal handling\nif err != nil && strings.Contains(err.Error(), \"wrong gid\") {\n    _ = deleteLocalTask(task.ID)\n}","handlingStrategy":"try-catch","validationCode":"infos, err := t.client.TorrentGetAllFor(context.TODO(), []int64{gid})\nif err != nil {\n    return nil, err\n}\nif len(infos) < 1 {\n    // torrent gone from daemon: terminal, no point retrying\n    markTerminalAndCleanup(task)\n    return nil, nil\n}","typeGuard":null,"tryCatchPattern":"s, err := t.Status(task)\nif err != nil && strings.Contains(err.Error(), \"wrong gid\") {\n    // remote torrent deleted: remove local record, do not retry\n    deleteLocalTask(task.ID)\n    return nil\n}","preventionTips":["Do not delete torrents in transmission's UI while OpenList tracks them","Clear offline task records whenever the transmission endpoint changes","Treat empty TorrentGetAllFor results as terminal, not transient"],"tags":["transmission","task-not-found","terminal-state","status"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}