jackwener/OpenCLI · error · CommandExecutionError

Add Workspace button not found

Error message

Add Workspace button not found

What it means

The Qoder 'add-workspace' UI command clicks a visible element containing 'Add Workspace' to open the folder picker. If the click script finds no matching visible element ({ok:false}), it throws CommandExecutionError('Add Workspace button not found'). It indicates the Add Workspace affordance was absent from the rendered Qoder DOM.

Source

Thrown at clis/qoder/ui.js:235

        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'View all button not visible', '');
        return [{ Status: 'clicked' }];
    },
});

// -------- add-workspace --------
cli({
    site: 'qoder',
    name: 'add-workspace',
    access: 'write',
    description: 'Click "Add Workspace" — opens the folder picker. Note: this opens a system file-picker dialog that Qoder controls; the actual folder selection must be done in the UI by the user.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = await evaluateQoder(page, clickByTextScript(['Add Workspace']));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Add Workspace button not found', '');
        return [{ Status: 'clicked — folder picker opened (manual selection required)' }];
    },
});

// -------- account --------
cli({
    site: 'qoder',
    name: 'account',
    access: 'read',
    description: 'Click the account button (username) in the Qoder sidebar and return the visible account dropdown items.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'username', required: false, help: 'Username text shown in the sidebar (default: tries common short labels)' },
    ],
    columns: ['Field', 'Value'],
    func: async (page, kwargs) => {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open Qoder with no folder (welcome state) or open the Explorer panel so the Add Workspace button is visible, then retry.
  2. Add a startup wait and re-run the command.
  3. Try alternate labels ('Add Workspace Folder', 'Open Folder') by extending the pattern list.
  4. Verify the actual DOM label via CDP DevTools and update clis/qoder/ui.js.
  5. Confirm the CDP session is attached to the main window (port 9237), not another target.

Example fix

// before
clickByTextScript(['Add Workspace'])
// after: include likely variants
clickByTextScript(['Add Workspace', 'Add workspace folder', 'Open Folder'])
Defensive patterns

Strategy: fallback

Validate before calling

async function addWorkspaceReachable(page) {
  const probe = await page.evaluate(`(() => {
    const texts = Array.from(document.querySelectorAll('button, [role="button"], a'))
      .map(b => (b.innerText||'').toLowerCase());
    return texts.some(t => t.includes('add workspace') || t.includes('open folder'));
  })()`);
  return probe === true;
}

Type guard

function isClickResult(res) {
  return res !== null && typeof res === 'object' && typeof res.ok === 'boolean';
}

Try / catch

try {
  await cli.run(['qoder', 'add-workspace']);
} catch (e) {
  if (String(e.message).includes('Add Workspace button not found')) {
    // fallback: use the menu path instead
    await cli.run(['qoder', 'more-actions']);
  } else throw e;
}

Prevention

When it happens

Trigger: Running 'add-workspace' when a workspace is already open and the button is hidden, the welcome/explorer panel is collapsed, the UI has not finished loading, or the label changed in a newer Qoder build.

Common situations: Qoder already has a folder open so the button shows different text ('Open Folder', a folder icon); welcome page dismissed; window minimized giving zero-size rects; version change removed the literal 'Add Workspace' label.

Related errors


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