{"record":{"id":"9bd9a1666c829a67","repo":"Kareadita/Kavita","slug":"dashboard-stream-doesnt-exist","errorCode":"dashboard-stream-doesnt-exist","errorMessage":"dashboard-stream-doesnt-exist","messagePattern":"dashboard-stream-doesnt-exist","errorType":"exception","errorClass":"KavitaException","httpStatus":400,"severity":"warning","filePath":"Kavita.Services/StreamService.cs","lineNumber":93,"sourceCode":"            Id = createdStream.Id,\n            Name = createdStream.Name,\n            IsProvided = createdStream.IsProvided,\n            Visible = createdStream.Visible,\n            Order = createdStream.Order,\n            SmartFilterEncoded = smartFilter.Filter,\n            StreamType = createdStream.StreamType\n        };\n\n        await eventHub.SendMessageToAsync(MessageFactory.DashboardUpdate, MessageFactory.DashboardUpdateEvent(user.Id),\n            userId, ct);\n\n        return ret;\n    }\n\n    public async Task UpdateDashboardStream(int userId, DashboardStreamDto dto, CancellationToken ct = default)\n    {\n        var stream = await unitOfWork.UserRepository.GetDashboardStream(dto.Id, ct);\n        if (stream == null) throw new KavitaException(await localizationService.TranslateAsync(userId, \"dashboard-stream-doesnt-exist\"));\n\n        if (stream.AppUserId != userId)\n        {\n            throw new KavitaNotFoundException();\n        }\n\n        stream.Visible = dto.Visible;\n\n        unitOfWork.UserRepository.Update(stream);\n        await unitOfWork.CommitAsync(ct);\n        await eventHub.SendMessageToAsync(MessageFactory.DashboardUpdate, MessageFactory.DashboardUpdateEvent(userId),\n            userId, ct);\n    }\n\n    public async Task UpdateDashboardStreamPosition(int userId, UpdateStreamPositionDto dto,\n        CancellationToken ct = default)\n    {\n        var user = await unitOfWork.UserRepository.GetUserByIdAsync(userId,","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/Kareadita/Kavita/blob/9c3e5400007f8a0282f7d883f2ad5e71716e514d/Kavita.Services/StreamService.cs#L75-L111","documentation":"Thrown by StreamService.UpdateDashboardStream when UserRepository.GetDashboardStream(dto.Id) returns null — the dashboard stream id does not exist. The message is translated to 'Dashboard Stream doesn't exist'. StreamController.UpdateDashboardStream does not catch KavitaException, so it surfaces as HTTP 500 via ExceptionMiddleware. (A subsequent ownership check on an existing-but-foreign stream instead throws KavitaNotFoundException, which becomes HTTP 404.)","triggerScenarios":"POST /api/stream/update-dashboard-stream with a DashboardStreamDto.Id that no longer exists (deleted stream, stale client state, id from another user).","commonSituations":"Client updates visibility for a stream that was removed elsewhere; restored/old layout cached in the browser; concurrent edits where one client deleted the stream.","solutions":["Refresh the dashboard layout (GET /api/stream/dashboard) before editing visibility.","Drop the update silently if the stream is no longer present.","Guard the UI so updates target ids currently in the loaded layout."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const dashboard = await api.get('/api/stream/dashboard');\nif (!dashboard.some(d => d.id === dto.id)) {\n  // stream no longer exists; nothing to update\n  return;\n}\nawait api.post('/api/stream/update-dashboard-stream', dto);","typeGuard":"function streamStillExists(id: number, dashboard: { id: number }[]): boolean {\n  return dashboard.some(d => d.id === id);\n}","tryCatchPattern":null,"preventionTips":["Refresh the dashboard before editing stream visibility.","Ignore updates for ids absent from the loaded layout.","Re-fetch and reconcile after concurrent edits."],"tags":["dashboard-stream","stream","validation","not-found"],"backgroundTag":null,"analyzedSha":"9c3e5400007f8a0282f7d883f2ad5e71716e514d","analyzedAt":"2026-08-13T19:06:05.897Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}