jackwener/OpenCLI · error · CommandExecutionError

open-panel failed

Error message

open-panel failed

What it means

Thrown by the qoder open-panel UI command when clicking visible text 'Open Panel'/'Close Panel' fails. As with the other UI commands, CommandExecutionError carries res.reason if the injected script reported one, else the generic fallback message. The panel toggle control didn't match the scripted text.

Source

Thrown at clis/qoder/ui.js:54

        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'sidebar-toggle failed', '');
        return [{ Status: `clicked: ${res.matched}` }];
    },
});

// -------- open-panel --------
cli({
    site: 'qoder',
    name: 'open-panel',
    access: 'write',
    description: 'Open / close the Qoder bottom panel (Output / Terminal / Debug Console). ⌥⌘B equivalent.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = await evaluateQoder(page, clickByTextScript(['Open Panel', 'Close Panel']));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'open-panel failed', '');
        return [{ Status: `clicked: ${res.matched}` }];
    },
});

// -------- search --------
cli({
    site: 'qoder',
    name: 'search',
    access: 'read',
    description: 'Open Qoder Search palette (⌘P), type a query, return matched options.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search text' },
        { name: 'limit', type: 'int', required: false, default: 20 },
    ],
    columns: ['Index', 'Item'],

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the exact button text in the live UI and update the clickByTextScript strings.
  2. Add an aria-label/title-based fallback via clickFirstScript.
  3. Add a wait for page readiness before running the command.
  4. Confirm the current Qoder page actually has the panel feature.

Example fix

// before
const res = await evaluateQoder(page, clickByTextScript(['Open Panel', 'Close Panel']));
if (!res?.ok) throw new CommandExecutionError(res?.reason || 'open-panel failed', '');
// after
let res = await evaluateQoder(page, clickByTextScript(['Open Panel', 'Close Panel']));
if (!res?.ok) res = await evaluateQoder(page, clickFirstScript(['[aria-label="Open Panel"]', '[aria-label="Close Panel"]']));
if (!res?.ok) throw new CommandExecutionError(res?.reason || 'open-panel failed', '');
Defensive patterns

Strategy: try-catch

Validate before calling

const panelBtn = await page.evaluate(`Array.from(document.querySelectorAll('button')).some(b => /Panel/.test(b.textContent || ''))`);
if (!panelBtn) console.warn('Panel toggle not present on this page');

Type guard

function isClickOk(res) { return Boolean(res && res.ok === true); }

Try / catch

try {
  await openPanel(page);
} catch (e) {
  if (/open-panel failed/.test(String(e.message))) console.warn('Panel control unavailable; skipping');
  else throw e;
}

Prevention

When it happens

Trigger: Panel button text/label changed in the Qoder UI; the panel feature is not present on the current page; the button is icon-only with no matching text node; the page hadn't mounted the panel control yet.

Common situations: Qoder update renamed the panel toggle; running on a page variant (e.g. a different Qoder surface) without the panel; slow load so the button isn't in the DOM when clicked; localized UI text.

Related errors


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