jackwener/OpenCLI · error · Error

returned no success evidence

Error message

 returned no success evidence

What it means

assertOkStatus checks that the parsed comment-add response is an object with status === 'ok'. Instagram's web comments API confirms success via this field; any other shape or status means the comment was not posted, so the CLI throws '${label} returned no success evidence'.

Source

Thrown at clis/instagram/comment.js:48

      return await response.json();
    } 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');
    return { pk };
  }
  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 } = 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/comments/' + pk + '/add/', {
    method: 'POST', credentials: 'include',
    headers: { ...headers, 'X-CSRFToken': csrf, 'Content-Type': 'application/x-www-form-urlencoded' },
    body: 'comment_text=' + encodeURIComponent(commentText),
  });
  if (!r2.ok) throw new Error('Failed to comment: HTTP ' + r2.status);
  assertOkStatus(await readInstagramJson(r2, 'Instagram comment'), 'Instagram comment');
  return [{ status: 'Commented', user: username, text: commentText }];
})()

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the response message field for the specific reason (duplicate, blocked, comments disabled)
  2. Deduplicate comment texts and add jitter/delays to avoid spam detection
  3. Refresh session cookies / use a less-flagged account if comments are silently rejected
  4. Confirm the post allows comments before attempting

Example fix

// before
function assertOkStatus(payload, label) {
  if (!payload || typeof payload !== 'object' || payload.status !== 'ok') {
    throw new Error(label + ' returned no success evidence');
  }
}
// after
function assertOkStatus(payload, label) {
  if (!payload || typeof payload !== 'object' || payload.status !== 'ok') {
    throw new Error(label + ' returned no success evidence: ' + JSON.stringify(payload).slice(0, 200));
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

const payload = await readInstagramJson(r2, 'comment');
if (!payload || typeof payload !== 'object' || payload.status !== 'ok') {
  console.error('Comment rejected:', JSON.stringify(payload));
}

Type guard

function isSuccessPayload(p) {
  return !!p && typeof p === 'object' && p.status === 'ok';
}

Try / catch

try {
  await runCommentPipeline(args);
} catch (e) {
  if (/no success evidence/.test(e.message)) {
    console.error('Comment not accepted (duplicate, blocked, or comments disabled)');
  } else throw e;
}

Prevention

When it happens

Trigger: POST /api/v1/web/comments/{pk}/add/ returns 200 with status 'fail', a message like 'commenting is off', a duplicate-comment error, or an unexpected payload shape with no status field.

Common situations: Posting duplicate comments (spam filter); commenting on a post with comments disabled; account temporarily blocked from commenting; shadow-flagged session returning soft-failure bodies.

Related errors


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