jackwener/OpenCLI · error · CommandExecutionError

ChatGPT did not open the requested project ${id}. Current UR

Error message

ChatGPT did not open the requested project ${id}. Current URL: ${state.url || '(unknown)'}

What it means

Thrown after loading a ChatGPT project when the page state check fails: the session is logged in (no AuthRequiredError), but projectIdFromUrl(state.url) does not match the requested project id, meaning ChatGPT did not actually open that project.

Source

Thrown at clis/chatgpt/utils.js:2945

];

/**
 * Navigate to a ChatGPT project page.
 */
export async function navigateToProject(page, projectId) {
    const id = parseChatGPTProjectId(projectId);
    await page.goto(`${CHATGPT_URL}/g/g-p-${id}`, { settleMs: 2000 });
    try {
        await page.wait({ selector: COMPOSER_WAIT_SELECTOR, timeout: 10 });
    } catch {
        // Composer may not mount if project requires login; downstream ensureChatGPTLogin handles it.
    }
    const state = await getPageState(page);
    if (projectIdFromUrl(state.url) === id) return id;
    if (state.hasLoginGate || !state.isLoggedIn) {
        throw new AuthRequiredError(CHATGPT_DOMAIN, 'ChatGPT project requires a logged-in ChatGPT session.');
    }
    throw new CommandExecutionError(
        `ChatGPT did not open the requested project ${id}.`,
        `Current URL: ${state.url || '(unknown)'}`,
    );
}

/**
 * Open the Project knowledge files dialog by clicking the "Add files" button
 * in the project header area (NOT the chat composer's plus button).
 * Returns true if the dialog appeared.
 */
export async function openProjectKnowledgeDialog(page) {
    const rawOpenResult = unwrapEvaluateResult(await page.evaluate(`
        (() => {
            const labels = ${JSON.stringify(PROJECT_ADD_FILES_LABELS)};
            const isVisible = (el) => {
                if (!(el instanceof HTMLElement)) return false;
                const style = window.getComputedStyle(el);
                if (style.display === 'none' || style.visibility === 'hidden') return false;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the project id (re-list projects) — it may be deleted or mistyped
  2. Check you have access/permission to the project in the logged-in account
  3. Retry once after a short delay to let the SPA finish updating the URL, or wait for the project URL explicitly before verifying
  4. Open the project URL manually in the same profile to see where ChatGPT redirects

Example fix

// before
await page.goto(projectUrl);
const id = await ensureChatGPTProjectOpen(page, projectId);
// after
await page.goto(projectUrl);
await page.waitForURL(/project/, { timeout: 15000 });
const id = await ensureChatGPTProjectOpen(page, projectId);
Defensive patterns

Strategy: validation

Validate before calling

const state = await getPageState(page);
if (projectIdFromUrl(state.url) !== projectId) {
  throw new Error(`project ${projectId} not open; current URL: ${state.url}`);
}

Type guard

function projectIsOpen(state, id) { return !!state?.url && projectIdFromUrl(state.url) === id; }

Try / catch

try {
  await openChatGPTProject(page, projectId);
} catch (e) {
  if (String(e.message).startsWith('ChatGPT did not open the requested project')) {
    // re-list projects to confirm the id exists, check permissions, then retry once
  } else throw e;
}

Prevention

When it happens

Trigger: getPageState returns a URL whose parsed project id differs from the requested id (or is not a project URL at all) after navigation/verification attempts — redirect to home, project deleted/unavailable, or the SPA landed on a fallback view.

Common situations: Project id typo or stale id from a deleted/renamed project; no access to a shared project (permission revoked); ChatGPT redirecting to home because the project 404s; SPA race where the URL hasn't updated yet.

Related errors


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