{"record":{"id":"36135dccf5dec279","repo":"wtfutil/wtf","slug":"client-was-not-initialized","errorCode":null,"errorMessage":"client was not initialized","messagePattern":"client was not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/transmission/widget.go","lineNumber":45,"sourceCode":"\t\tScrollableWidget: view.NewScrollableWidget(tviewApp, redrawChan, pages, settings.Common),\n\n\t\tsettings: settings,\n\t}\n\n\twidget.SetRenderFunction(widget.display)\n\twidget.initializeKeyboardControls()\n\n\tgo buildClient(&widget)\n\n\treturn &widget\n}\n\n/* -------------------- Exported Functions -------------------- */\n\n// Fetch retrieves torrent data from the Transmission daemon\nfunc (widget *Widget) Fetch() ([]transmissionrpc.Torrent, error) {\n\tif widget.client == nil {\n\t\treturn nil, errors.New(\"client was not initialized\")\n\t}\n\n\ttorrents, err := widget.client.TorrentGetAll(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := make([]transmissionrpc.Torrent, 0)\n\tfor _, torrent := range torrents {\n\t\tif widget.settings.hideComplete {\n\t\t\tif *torrent.PercentDone == 1.0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tout = append(out, torrent)\n\t}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/transmission/widget.go#L27-L63","documentation":"The transmission widget's Fetch method returns this error when widget.client is nil, i.e. the Transmission RPC client was never initialized (normally done in the widget constructor by connecting to the Transmission daemon). Fetch refuses to proceed rather than panic on a nil client.","triggerScenarios":"Calling widget.Fetch() (directly or via Refresh) when the constructor failed to create the RPC client — typically because the Transmission daemon was unreachable, the RPC URL/credentials in the module settings are wrong, or NewClient errored at startup.","commonSituations":"Transmission daemon not running or listening on a different port than configured; wrong rpc-url, username, or password in the WTFUtil config; daemon's rpc-whitelist rejecting the host; token/auth handshake failing so client creation silently yields nil.","solutions":["Start the Transmission daemon and confirm it is listening (default http://localhost:9091/transmission/rpc).","Check the transmission module settings in the WTFUtil config: correct URL, port, username, and password.","If the daemon enforces rpc-whitelist or rpc-authentication-required, allow your host or supply credentials.","Restart WTFUtil after fixing settings so the widget constructor re-initializes the client."],"exampleFix":"// before (config.yml)\ntransmission:\n  url: \"http://localhost:9091\"  # missing /transmission/rpc path\n\n// after\ntransmission:\n  url: \"http://localhost:9091/transmission/rpc\"\n  username: \"user\"\n  password: \"pass\"","handlingStrategy":"validation","validationCode":"resp, err := http.Get(\"http://localhost:9091/transmission/rpc\")\nif err != nil {\n    return errors.New(\"Transmission daemon unreachable; client will be nil\")\n}\nif resp != nil && resp.Body != nil {\n    resp.Body.Close()\n}","typeGuard":null,"tryCatchPattern":"torrents, err := widget.Fetch()\nif err != nil && err.Error() == \"client was not initialized\" {\n    // re-create widget / fix daemon connection before retrying\n}","preventionTips":["Ensure the Transmission daemon is running before starting wtfutil.","Match rpc-url, port, username, and password exactly with daemon settings.","Whitelist your host in the daemon's rpc-whitelist if enabled."],"tags":["transmission","rpc","initialization","configuration"],"backgroundTag":"client-not-initialized","analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}