jackwener/OpenCLI · warning · EmptyResultError

No Codex projects matched "${kwargs.project}". / No Codex pr

Error message

No Codex projects matched "${kwargs.project}". / No Codex projects were visible. Open the Codex sidebar and retry.

What it means

The Codex projects list command found zero projects to display. The library throws EmptyResultError when readCodexProjects returns data but no rows survive filtering, or when nothing at all was visible, to give a clear signal instead of printing an empty table.

Source

Thrown at clis/codex/projects.js:22

export const projectsCommand = cli({
    site: 'codex',
    name: 'projects',
    access: 'read',
    description: 'List Codex projects and visible conversations from the sidebar',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'project', required: false, help: 'Filter by project label or path' },
        { name: 'limit', required: false, help: 'Max conversations per project' },
    ],
    columns: ['Project', 'Index', 'Title', 'Updated', 'Active'],
    func: async (page, kwargs) => {
        const projects = await readCodexProjects(page);
        const rows = flattenCodexProjects(projects, kwargs);
        if (rows.length === 0) {
            throw new EmptyResultError('codex projects', kwargs.project
                ? `No Codex projects matched "${kwargs.project}".`
                : 'No Codex projects were visible. Open the Codex sidebar and retry.');
        }
        return rows;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run without the --project filter to see all visible projects and their exact names, then match one exactly.
  2. Open the Codex sidebar in the browser and confirm projects are visible and loaded before retrying.
  3. If no projects exist yet, create/open a project in Codex first.
  4. Retry after the page finishes loading, in case the sidebar was still hydrating.

Example fix

// before
$ codex projects --project "my-proj"
// EmptyResultError: No Codex projects matched "my-proj".

// after: list everything first to find the exact name
$ codex projects
$ codex projects --project "My Proj"
Defensive patterns

Strategy: validation

Validate before calling

const visible = await listCodexProjects(); // run without filter
const name = kwargs.project;
if (name && !visible.some(p => p.title === name)) {
  throw new Error(`Unknown project "${name}". Available: ${visible.map(p => p.title).join(', ')}`);
}

Try / catch

try {
  const rows = await codexProjects({ project: name });
} catch (e) {
  if (e instanceof EmptyResultError) {
    console.warn('No projects; showing all instead.');
    return codexProjects({});
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the codex projects command with a --project filter that matches none of the visible Codex projects, or running it with no filter when readCodexProjects(page) returns an empty projects list from the Codex sidebar.

Common situations: Typo or wrong casing in the project filter name; Codex sidebar not loaded or collapsed (projects never rendered); being on a fresh Codex workspace with no projects yet; stale page state where the projects panel hasn't hydrated yet.

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/3d7df24950a92888. Report an issue: GitHub.