jackwener/OpenCLI · error · CommandExecutionError

${name} menu item was clicked, but the conversation did not

Error message

${name} menu item was clicked, but the conversation did not verify as ${expectedState}.${labels}

What it means

This error fires when the pin/unpin menu item was clicked successfully but the follow-up verification (waitForConversationPinState) shows the conversation did not reach the expected state, with the observed menu labels appended. It's a post-action consistency check: the click happened but Grok did not apply (or did not reflect) the state change.

Source

Thrown at clis/grok/pin.js:54

            const expectedState = name === 'pin' ? 'pinned' : 'unpinned';
            const before = await readConversationMenuLabels(page, id);
            if (!before.ok) {
                const detail = before.detail ? ` ${before.detail}` : '';
                throw new CommandExecutionError(`${before.reason || `Failed to inspect ${name} state.`}${detail}`, SESSION_HINT);
            }
            if (getPinStateFromMenuLabels(before.labels) === expectedState) {
                return [{ status: `already-${expectedState}`, id }];
            }

            const result = await clickConversationMenuItem(page, id, accessLabels);
            if (!result || !result.ok) {
                const detail = result?.detail ? ` ${result.detail}` : '';
                throw new CommandExecutionError(`${result?.reason || `Failed to ${name} conversation.`}${detail}`, SESSION_HINT);
            }
            const verified = await waitForConversationPinState(page, id, expectedState);
            if (!verified.ok) {
                const labels = verified.labels?.length ? ` labels=${JSON.stringify(verified.labels)}` : '';
                throw new CommandExecutionError(
                    `${name} menu item was clicked, but the conversation did not verify as ${expectedState}.${labels}`,
                    SESSION_HINT,
                );
            }
            return [{ status: name === 'pin' ? 'pinned' : 'unpinned', id }];
        },
    });
}

// Grok's context menu shows EITHER "置顶" OR "取消置顶" depending on the
// current pin state, never both. We register two commands that bind to
// the matching label so callers can use whichever they want.
defineToggle('pin', ['置顶', 'pin']);
defineToggle('unpin', ['取消置顶', 'unpin']);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command; often the second attempt verifies because state settled.
  2. Inspect the labels= JSON in the message to see the actual menu state.
  3. Manually check the conversation in grok.com to see if it actually pinned/unpinned.
  4. Increase verification patience or update selectors if labels changed.

Example fix

// before
cli pin --id <id>  // clicked but labels never showed 'pinned'
// after
cli pin --id <id>  // retry after backend settles; or verify manually in the tab
Defensive patterns

Strategy: retry

Validate before calling

// Pre-check current pin state via the same menu read the library uses:
const before = await readConversationMenuLabels(page, id);
const isPinned = before.ok && before.labels.some(l => /unpin/i.test(l));
if (isPinned) console.log('already pinned; skipping');

Try / catch

try {
  const res = await cli.pin({ id });
} catch (e) {
  if (e instanceof CommandExecutionError && /did not verify as/.test(e.message)) {
    const labels = e.message.match(/labels=(\[.*\])/)?.[1];
    console.warn(`Pin click unverified (labels=${labels}); re-checking state and retrying once.`);
    return cli.pin({ id });
  }
  throw e;
}

Prevention

When it happens

Trigger: waitForConversationPinState returns {ok:false} after the click — the pin toggle failed server-side, the verification window was too short, or the menu labels never flipped to 'pinned'/'unpinned'.

Common situations: Grok backend lag delaying the state change past the verification window, the toggle silently rejected for that conversation, or a UI update changing label text so verification mismatches.

Related errors


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