jackwener/OpenCLI · warning · EmptyResultError

chatgpt project-list

Error message

chatgpt project-list

What it means

EmptyResultError thrown by `chatgpt project-list` after login succeeds but `getProjectList(page)` finds zero project links in the sidebar. It signals the command succeeded mechanically but there was nothing to return.

Source

Thrown at clis/chatgpt/project-list.js:33

    domain: CHATGPT_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'limit', type: 'int', default: 20, help: 'Max projects to show' },
    ],
    columns: ['Index', 'Id', 'Title', 'Url'],
    func: async (page, kwargs) => {
        const limit = requirePositiveInt(
            Number(kwargs.limit ?? 20),
            'chatgpt project-list --limit',
            'Example: opencli chatgpt project-list --limit 20',
        );
        await ensureChatGPTLogin(page, 'ChatGPT project-list requires a logged-in ChatGPT session.');
        const projects = await getProjectList(page);
        if (!projects.length) {
            throw new EmptyResultError('chatgpt project-list', 'No ChatGPT project links were visible in the sidebar.');
        }
        return projects.slice(0, limit);
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Create a ChatGPT project in the web UI first, then re-run.
  2. Expand/collapse the sidebar (or wait for it to load) and retry.
  3. Verify the expected projects exist at chatgpt.com in the browser.
  4. Update the CLI selectors if the ChatGPT sidebar markup changed.
Defensive patterns

Strategy: try-catch

Validate before calling

// Nothing to pre-validate client-side; optionally pre-check via UI:
const hasSidebar = await page.$('[data-testid="sidebar"]') !== null;
if (!hasSidebar) throw new Error('Sidebar not loaded; retry later');

Type guard

function isNonEmptyProjects(p) { return Array.isArray(p) && p.length > 0; }

Try / catch

try {
  const projects = await run(['chatgpt', 'project-list', '--limit', '20']);
} catch (err) {
  if (String(err.message).includes('chatgpt project-list')) {
    console.log('No projects found — create one at chatgpt.com or expand the sidebar.');
  }
}

Prevention

When it happens

Trigger: Running `chatgpt project-list` (optionally with --limit) on a logged-in session where the sidebar contains no ChatGPT project entries.

Common situations: Account genuinely has no projects; sidebar collapsed or hidden projects section not expanded; ChatGPT UI redesign moved/renamed project links so selectors miss them; slow load so the sidebar hadn't rendered.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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