jackwener/OpenCLI · error

returned no success evidence

Error message

 returned no success evidence

What it means

Thrown by `assertOkStatus` after the save POST succeeds at the HTTP level: the parsed JSON body must be an object with `status === 'ok'`. If the save endpoint (/api/v1/web/save/<pk>/save/) returns JSON without `status: 'ok'` (e.g. `{"status": "fail"}` or an error object with HTTP 200/2xx), the CLI treats the save as unverified and throws.

Source

Thrown at clis/instagram/save.js:47

    } catch {
      throw new Error(label + ' returned invalid JSON');
    }
  }
  function getPostFromFeed(feed, label) {
    if (!feed || typeof feed !== 'object' || !Array.isArray(feed.items)) {
      throw new Error(label + ' returned malformed items payload');
    }
    if (idx >= feed.items.length) throw new Error('Post index ' + (idx + 1) + ' not found');
    const post = feed.items[idx];
    const pkRaw = post?.pk ?? post?.id;
    const pk = typeof pkRaw === 'number' ? String(pkRaw) : (typeof pkRaw === 'string' ? pkRaw.trim() : '');
    if (!/^\\d+$/.test(pk)) throw new Error(label + ' returned malformed post row');
    const caption = typeof post?.caption?.text === 'string' ? post.caption.text.substring(0, 60) : '';
    return { pk, caption };
  }
  function assertOkStatus(payload, label) {
    if (!payload || typeof payload !== 'object' || payload.status !== 'ok') {
      throw new Error(label + ' returned no success evidence');
    }
  }

  // web_profile_info answers HTTP 400 for business accounts; feed-by-username needs no user id. See #2234.
  const r1 = await fetch('https://www.instagram.com/api/v1/feed/user/' + encodeURIComponent(username) + '/username/?count=' + (idx + 1), opts);
  if (!r1.ok) throw new Error(r1.status === 404 ? 'User not found: ' + username : 'HTTP ' + r1.status + ' - make sure you are logged in to Instagram');
  const { pk, caption } = getPostFromFeed(await readInstagramJson(r1, 'Instagram feed-by-username'), 'Instagram feed-by-username');

  const csrf = document.cookie.match(/csrftoken=([^;]+)/)?.[1] || '';
  const r2 = await fetch('https://www.instagram.com/api/v1/web/save/' + pk + '/save/', {
    method: 'POST', credentials: 'include',
    headers: { ...headers, 'X-CSRFToken': csrf, 'Content-Type': 'application/x-www-form-urlencoded' },
  });
  if (!r2.ok) throw new Error('Failed to save: HTTP ' + r2.status);
  assertOkStatus(await readInstagramJson(r2, 'Instagram save'), 'Instagram save');
  return [{ status: 'Saved', user: username, post: caption || '(post #' + (idx+1) + ')' }];
})()
` },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Refresh the Instagram session and csrftoken (re-login in the CLI browser profile) and retry — a stale CSRF token commonly causes soft failures.
  2. Retry after a delay if the account is rate-limited or action-blocked; avoid rapid repeated saves.
  3. Check the response body (DevTools/verbose logging) to see the actual status/message Instagram returned.
  4. Verify on instagram.com whether the post was actually saved — sometimes the save succeeds despite a non-standard envelope.
Defensive patterns

Strategy: retry

Type guard

function isSaveSuccess(payload) {
  return payload !== null && typeof payload === 'object' && payload.status === 'ok';
}

Try / catch

try {
  await run(['instagram', 'save', username, '--index', String(i)]);
} catch (e) {
  if (String(e.message).includes('returned no success evidence')) {
    // soft failure with 2xx: refresh session/CSRF and back off before retrying
    await refreshInstagramLogin();
    return retryWithBackoff(() => run(['instagram', 'save', username, '--index', String(i)]), { attempts: 2, baseDelayMs: 30000 });
  }
  throw e;
}

Prevention

When it happens

Trigger: POST /api/v1/web/save/<pk>/save/ returns an HTTP 2xx response whose JSON body lacks `status: 'ok'` — e.g. Instagram returns a soft-failure object (rate limit, action blocked, session flagged) with status 200, or the CSRF token sent was stale so the server returns a non-ok status envelope.

Common situations: Instagram has flagged the account for automation and silently rejects the save; the csrftoken cookie read from document.cookie is empty or expired; the account hit a save/action limit; Instagram A/B test changes the response envelope.

Related errors


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