jackwener/OpenCLI · error · AuthRequiredError

Sign in to grok.com in your browser, then retry.

Error message

Sign in to grok.com in your browser, then retry.

What it means

The grok pin/unpin commands (defineToggle) open the conversation's context menu, first verifying the user is logged in (throwing AuthRequiredError via authRequired() when not) and then reading the menu labels via readConversationMenuLabels to determine the current pinned state. When the menu cannot be read (before.ok false), it throws a CommandExecutionError carrying the inspection reason, any detail, and a session hint. Login failure is the most common cause of this path.

Source

Thrown at clis/grok/pin.js:34

function defineToggle(name, accessLabels) {
    cli({
        site: 'grok',
        name,
        access: 'write',
        description: `${name === 'pin' ? 'Pin' : 'Unpin'} a Grok conversation by ID`,
        domain: GROK_DOMAIN,
        strategy: Strategy.COOKIE,
        browser: true,
        siteSession: 'persistent',
        args: [
            { name: 'id', positional: true, type: 'string', required: true, help: 'Conversation UUID or grok.com/c/<uuid> URL' },
        ],
        columns: ['status', 'id'],
        func: async (page, kwargs) => {
            const id = parseGrokSessionId(kwargs.id);
            await ensureOnGrok(page);
            if (!(await isLoggedIn(page))) throw authRequired();

            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) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Sign in to grok.com in the browser profile the CLI drives, then rerun the pin/unpin command.
  2. Confirm the conversation id (UUID or grok.com/c/<uuid> URL) exists and appears in the sidebar.
  3. Reload grok.com in the driven browser so the sidebar and menus render freshly, then retry.
  4. If the menu probe still fails after sign-in and reload, the Grok UI likely changed — update the CLI/extension to a matching version.

Example fix

// before: opencli grok pin <uuid> while signed out -> CommandExecutionError/AuthRequiredError
// after: sign in to grok.com in the driven profile, reload, then rerun: opencli grok pin <uuid>
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await grokPin(id);
} catch (e) {
  if (/Sign in to grok\.com/i.test(e.message) || e.name === 'AuthRequiredError') {
    // sign in to grok.com in the driven profile, then retry
  } else if (e.name === 'CommandExecutionError') {
    // conversation may not be in the sidebar — verify id, reload page, retry
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Running grok pin <id> or grok unpin <id> when isLoggedIn(page) is false, or when readConversationMenuLabels cannot open/read the conversation's three-dot menu (conversation not found in sidebar, sidebar not loaded, DOM changed, menu closed prematurely).

Common situations: Signed-out or expired grok.com session in the driven profile; the target conversation id is not present in the current sidebar list (unpinned conversations may not be listed); Grok DOM updates breaking the menu label probe.

Related errors


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