Skip to content

[autofix] instagram/following: API_ERROR (HTTP 400 above ~200 results — no pagination) #1831

@Alek0220

Description

@Alek0220

Summary

OpenCLI autofix repaired this adapter locally, and the retry passed.

Adapter

  • Site: instagram
  • Command: following
  • OpenCLI version: 1.7.22
  • File: clis/instagram/following.js

Original failure

  • Error code: API_ERROR (surfaced as UNKNOWN / HTTP 400)
Error: Failed to fetch following: HTTP 400

opencli instagram following <user> --limit N succeeds for N up to ~200 but throws HTTP 400 for larger limits (250/296/300). Root cause: the adapter issues a single request to /api/v1/friendships/{userId}/following/?count={limit} with the user-supplied limit passed straight through as count. Instagram's friendships endpoint rejects large count values with HTTP 400, and the adapter never paginates — so any account followed by more than ~200 users cannot be fully listed.

Local fix summary

Replaced the single fetch with a pagination loop: fetch a safe page (count=50),
follow the `next_max_id` cursor, accumulate + dedupe by `pk`, with light pacing
(~400ms) between pages, until `limit` results are gathered or the cursor runs out.
Verified against an account following 296 — full list now returns (295 unique).

Issue filed by OpenCLI autofix after a verified local repair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions