{"record":{"id":"155c9a1f74115c9f","repo":"invoke-ai/InvokeAI","slug":"failed-to-remove-video-from-board","errorCode":null,"errorMessage":"Failed to remove video from board","messagePattern":"Failed to remove video from board","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/videos.py","lineNumber":930,"sourceCode":"    # board is Public). This mirrors remove_image_from_board and prevents a video from being\n    # stranded when a non-owner uploads into a Public board that is later made Shared/Private:\n    # without the board-write fallback, neither the uploader nor the board owner could\n    # detach the video. See PR #9163 review.\n    old_board_id = ApiDependencies.invoker.services.board_video_records.get_board_for_video(video_name)\n    try:\n        _assert_video_direct_owner(video_name, current_user)\n    except HTTPException:\n        if old_board_id is None:\n            raise\n        _assert_board_write_access(old_board_id, current_user)\n    try:\n        ApiDependencies.invoker.services.board_video_records.remove_video_from_board(video_name=video_name)\n        return RemoveVideosFromBoardResult(\n            removed_videos=[video_name],\n            affected_boards=list({old_board_id or \"none\", \"none\"}),\n        )\n    except Exception:\n        raise HTTPException(status_code=500, detail=\"Failed to remove video from board\")\n","sourceCodeStart":912,"sourceCodeEnd":931,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/videos.py#L912-L931","documentation":"HTTP 500 raised by remove_video_from_board when the board_video_records service fails to remove a video's board association. Any exception in ApiDependencies.invoker.services.board_video_records.remove_video_from_board is converted to HTTPException(500, detail='Failed to remove video from board').","triggerScenarios":"DELETE /api/v1/videos/board with a video_name that doesn't exist or whose board-record row cannot be deleted (DB error, constraint, missing row).","commonSituations":"Video already removed (double-delete from UI retry); video record deleted elsewhere so the association row is gone; database connectivity issues.","solutions":["Retry — if the association is already gone the operation may be idempotent after the underlying fix","Verify the video exists and check its current board membership first","Check server logs for the wrapped exception to see the DB-level cause","If the video record is orphaned, clean up board associations directly in the DB or via re-adding/removing"],"exampleFix":"// before\nclient.remove_video_from_board(video_name=v)  # may 500 if already removed\n// after\ninfo = get_video_info(v)\nif info.get('board_id'):\n    client.remove_video_from_board(video_name=v)","handlingStrategy":"try-catch","validationCode":"// check current board membership before removing\nconst info = await fetch(`${base}/api/v1/videos/${encodeURIComponent(videoName)}/urls`);\nif (info.status === 404) throw new Error('video no longer exists; nothing to remove');","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(`${base}/api/v1/videos/board`, { method: 'DELETE', body });\n  if (r.status === 500 && alreadyRemoved) return; // treat as idempotent success\n  if (!r.ok) throw new Error(await r.text());\n} catch (e) { log(e); }","preventionTips":["Treat repeated removals as idempotent; guard against double-delete retries","Verify the video exists before issuing the DELETE","Check DB health if 500s cluster together"],"tags":["http-500","rest-api","boards","invokeai"],"backgroundTag":"internal-server-error-500","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}