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
- Create a ChatGPT project in the web UI first, then re-run.
- Expand/collapse the sidebar (or wait for it to load) and retry.
- Verify the expected projects exist at chatgpt.com in the browser.
- 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
- Create at least one ChatGPT project before listing.
- Wait for the sidebar to render before scraping.
- Expect an empty list on fresh accounts and handle it gracefully.
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
- Failed to export generated ChatGPT image assets
- chatgpt read
- discord-app channels
- linkedin timeline
- 未抓取到创作者后台文章 (page=${articlePage})。可能页面尚未完成渲染或无文章。
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5684e0a60131a1d0.
Report an issue: GitHub.