jackwener/OpenCLI · error · ArgumentError

tab must be configured / run-history / task-template

Error message

tab must be configured / run-history / task-template

What it means

The automation-list command normalizes kwargs.tab and maps it to a UI tab label ('configured' | 'run-history' | 'task-template'). If the value doesn't match any key, the label lookup yields undefined and this ArgumentError is thrown before any browser interaction. It's strict input validation of the --tab option.

Source

Thrown at clis/trae-solo/automation.js:62

    access: 'read',
    description: 'List Trae SOLO Automation tab content. Default tab is "Configured"; pass --tab to switch.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'tab', required: false, default: 'configured', help: 'Tab to view: configured / run-history / task-template' },
        { name: 'limit', type: 'int', required: false, default: 50 },
    ],
    columns: ['Index', 'Title', 'Summary'],
    func: async (page, kwargs) => {
        await switchToPanel(page, 'Automation');
        const tab = String(kwargs.tab || 'configured').trim().toLowerCase();
        const tabLabel = {
            'configured': 'Configured',
            'run-history': 'Run History',
            'task-template': 'Task Template',
        }[tab];
        if (!tabLabel) throw new ArgumentError('tab must be configured / run-history / task-template');
        await switchToAutomationTab(page, tabLabel);

        const items = await page.evaluate(`(function() {
      // Each tab renders its content in a different container; pull all
      // direct text rows from the main panel area.
      const main = document.querySelector('.task-list-base-content') || document.querySelector('main') || document.body;
      // Templates use .templateCard-... or similar. Configured items have a different shape.
      const candidates = Array.from(main.querySelectorAll('[class*="templateCard"], [class*="taskCard"], [class*="card"], li, [role="listitem"]'))
        .filter((el) => el.offsetParent);
      const out = [];
      const seen = new Set();
      for (const el of candidates) {
        const t = (el.innerText || '').replace(/\\s+/g, ' ').trim();
        if (!t || t.length < 3 || seen.has(t)) continue;
        // Filter UI chrome (tabs / heading / 'Create manually' / etc.)
        if (/^(Configured|Run History|Task Template|Create manually|Create in chat|Automation|Create from a template)$/.test(t)) continue;
        seen.add(t);
        const lines = t.split('\\n');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Use exactly one of: configured, run-history, task-template (case/whitespace insensitive)
  2. Fix hyphenation: use run-history not 'run history' or 'history'
  3. Omit --tab entirely to use the default 'configured'
  4. Check the CLI help for the automation-list command to see allowed values

Example fix

// before
await traeSoloCli.automationList({ tab: 'history' }); // throws
// after
await traeSoloCli.automationList({ tab: 'run-history' });
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED_TABS = ['configured', 'run-history', 'task-template'];
const tab = String(kwargs.tab ?? 'configured').trim().toLowerCase();
if (!ALLOWED_TABS.includes(tab)) throw new Error(`tab must be one of ${ALLOWED_TABS.join(', ')}`);

Type guard

const isTab = (t) => ['configured','run-history','task-template']
  .includes(String(t ?? 'configured').trim().toLowerCase());

Try / catch

try {
  await traeSoloCli.automationList({ tab });
} catch (e) {
  if (e instanceof ArgumentError && /tab must be/.test(e.message)) {
    console.error('Allowed tabs: configured, run-history, task-template');
  } else throw e;
}

Prevention

When it happens

Trigger: Passing tab with a value outside the allowed set, e.g. --tab history, --tab Templates, --tab 'run history' (space instead of hyphen), or any unrecognized string.

Common situations: Guessing tab names from memory; mixing up 'run-history' with 'history' or 'runs'; capitalization handled but hyphenation not; passing an empty/whitespace string is fine (defaults to 'configured') but a wrong word is not.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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