jackwener/OpenCLI · error · CommandExecutionError

HTTP ${result.httpStatus} from Instagram /users/info

Error message

HTTP ${result.httpStatus} from Instagram /users/info

What it means

A CommandExecutionError thrown when the whoami probe to Instagram's /api/v1/users/<uid>/info/ returns a non-ok status other than 401/403 (which would be auth errors instead). The library classifies this as a command-level HTTP failure rather than an auth problem, because the session may be fine but the API itself failed. The status code in the message indicates the actual problem.

Source

Thrown at clis/instagram/auth.js:38

        credentials: 'include',
        headers: { 'X-IG-App-ID': '936619743392459', 'Accept': 'application/json' },
      });
      if (r.status === 401 || r.status === 403) {
        return { kind: 'auth', detail: 'Instagram /users/info HTTP ' + r.status };
      }
      if (!r.ok) return { kind: 'http', httpStatus: r.status };
      const d = await r.json();
      const user = d?.user;
      if (!user || !user.pk) {
        return { kind: 'auth', detail: 'Instagram /users/info returned no pk — session likely expired' };
      }
      return { ok: true, user_id: String(user.pk), username: String(user.username || ''), full_name: String(user.full_name || '') };
    } catch (e) {
      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`);
  if (result?.kind === 'auth') throw new AuthRequiredError('www.instagram.com', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from Instagram /users/info`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`Instagram whoami failed: ${result.detail}`);
  if (!result?.ok) throw new CommandExecutionError(`Unexpected Instagram probe: ${JSON.stringify(result)}`);
  return { user_id: result.user_id, username: result.username, full_name: result.full_name };
}

registerSiteAuthCommands({
  site: 'instagram',
  domain: 'instagram.com',
  loginUrl: 'https://www.instagram.com/accounts/login/',
  columns: ['user_id', 'username', 'full_name'],
  quickCheck: hasInstagramSessionCookie,
  verify: verifyInstagramIdentity,
  poll: async (page) => {
    if (!await hasInstagramSessionCookie(page)) {
      throw new AuthRequiredError('www.instagram.com', 'Waiting for Instagram sessionid cookie');
    }
    return verifyInstagramIdentity(page);
  },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. If status is 429, wait several minutes before retrying — Instagram rate limits the account/IP
  2. For 5xx, retry after a short delay; usually transient
  3. Reduce request frequency and add delays between Instagram CLI invocations
  4. Retry after confirming you can browse instagram.com normally in the same browser profile

Example fix

// retry wrapper around the failing command
async function whoamiWithRetry(cmd, attempts = 3) {
  for (let i = 0; i < attempts; i++) {
    try { return await cmd(); }
    catch (e) {
      if (!/HTTP 5\d\d|HTTP 429/.test(e.message) || i === attempts - 1) throw e;
      await new Promise(r => setTimeout(r, 60000));
    }
  }
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  await instagramWhoami();
} catch (e) {
  const m = e.message.match(/HTTP (\d+) from Instagram \/users\/info/);
  if (m && (m[1] === '429' || m[1].startsWith('5'))) {
    await sleep(m[1] === '429' ? 120000 : 5000);
    return instagramWhoami();
  }
  throw e;
}

Prevention

When it happens

Trigger: Inside the verifyInstagramIdentity page.evaluate probe, the fetch to /api/v1/users/<uid>/info/ with credentials:'include' and X-IG-App-ID header returns a status like 429 or 5xx, so the script returns {kind:'http', httpStatus}.

Common situations: Instagram rate limiting the account after heavy automated use (429); transient Instagram server errors (5xx); a network middlebox/proxy returning an unexpected response inside the page context.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/760b69f5fffb18c8. Report an issue: GitHub.