{"record":{"id":"3f63b291d309c827","repo":"jackwener/OpenCLI","slug":"instagram-unfollow-returned-no-success-evidence","errorCode":null,"errorMessage":"Instagram unfollow returned no success evidence","messagePattern":"Instagram unfollow returned no success evidence","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clis/instagram/unfollow.js","lineNumber":41,"sourceCode":"  const opts = { credentials: 'include', headers };\n\n  ${buildResolveInstagramUserIdJs()}\n\n  const csrf = document.cookie.match(/csrftoken=([^;]+)/)?.[1] || '';\n  const r2 = await fetch('https://www.instagram.com/api/v1/friendships/destroy/' + userId + '/', {\n    method: 'POST',\n    credentials: 'include',\n    headers: { ...headers, 'X-CSRFToken': csrf, 'Content-Type': 'application/x-www-form-urlencoded' },\n  });\n  if (!r2.ok) throw new Error('Failed to unfollow: HTTP ' + r2.status);\n  let d2;\n  try {\n    d2 = await r2.json();\n  } catch {\n    throw new Error('Instagram unfollow returned invalid JSON');\n  }\n  if (!d2 || typeof d2 !== 'object' || d2.status !== 'ok') {\n    throw new Error('Instagram unfollow returned no success evidence');\n  }\n  return [{ status: 'Unfollowed', username }];\n})()\n` },\n    ],\n});\n","sourceCodeStart":23,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/unfollow.js#L23-L48","documentation":"The Instagram unfollow API responded 200 but its JSON body did not contain status:'ok', so the CLI cannot verify the unfollow actually happened. Instagram's web endpoints signal success only via status:'ok'; anything else (fail_status, empty body, HTML) is treated as failure. The CLI refuses to report 'Unfollowed' without that evidence.","triggerScenarios":"POST to /api/v1/friendships/destroy/{userId} returns JSON lacking status:'ok' — e.g. rate limiting, login cookie expired, or the target user was already unfollowed/blocked.","commonSituations":"Stale session cookies after Instagram logs the user out elsewhere; unfollowing a user already unfollowed; Instagram soft-banning automated unfollow bursts; privacy changes where the friendship row never existed.","solutions":["Re-authenticate: log into Instagram in the browser session the CLI uses and refresh cookies (especially sessionid and csrftoken).","Verify the username exists and you actually follow it before unfollowing.","Wait and retry later — Instagram rate-limits bulk unfollow actions.","Run with fewer actions per session to avoid automation throttling."],"exampleFix":"// before\nawait api.unfollow('someuser');\n// after\ntry {\n  await api.unfollow('someuser');\n} catch (e) {\n  if (e.message.includes('no success evidence')) {\n    await refreshInstagramSession(); // re-login, then retry once\n    await api.unfollow('someuser');\n  } else throw e;\n}","handlingStrategy":"try-catch","validationCode":"const followed = await checkFriendship(username);\nif (!followed) return skip('already unfollowed');","typeGuard":"const unfollowOk = (d) => !!d && typeof d === 'object' && d.status === 'ok';","tryCatchPattern":"try {\n  await cli.unfollow(username);\n} catch (e) {\n  if (e.message.includes('no success evidence')) {\n    await refreshSession();\n    await cli.unfollow(username);\n  } else throw e;\n}","preventionTips":["Refresh session cookies before batch unfollow runs","Check friendship status before unfollowing","Throttle unfollow actions to avoid soft bans"],"tags":["instagram","authentication","api-response","rate-limit"],"backgroundTag":"api-response-missing-success-status","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}