{"record":{"id":"e090592c7e03fb4d","repo":"jackwener/OpenCLI","slug":"chatgpt-did-not-open-the-requested-project-id","errorCode":null,"errorMessage":"ChatGPT did not open the requested project ${id}. Current URL: ${state.url || '(unknown)'}","messagePattern":"ChatGPT did not open the requested project (.+?)\\. Current URL: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/utils.js","lineNumber":2945,"sourceCode":"];\n\n/**\n * Navigate to a ChatGPT project page.\n */\nexport async function navigateToProject(page, projectId) {\n    const id = parseChatGPTProjectId(projectId);\n    await page.goto(`${CHATGPT_URL}/g/g-p-${id}`, { settleMs: 2000 });\n    try {\n        await page.wait({ selector: COMPOSER_WAIT_SELECTOR, timeout: 10 });\n    } catch {\n        // Composer may not mount if project requires login; downstream ensureChatGPTLogin handles it.\n    }\n    const state = await getPageState(page);\n    if (projectIdFromUrl(state.url) === id) return id;\n    if (state.hasLoginGate || !state.isLoggedIn) {\n        throw new AuthRequiredError(CHATGPT_DOMAIN, 'ChatGPT project requires a logged-in ChatGPT session.');\n    }\n    throw new CommandExecutionError(\n        `ChatGPT did not open the requested project ${id}.`,\n        `Current URL: ${state.url || '(unknown)'}`,\n    );\n}\n\n/**\n * Open the Project knowledge files dialog by clicking the \"Add files\" button\n * in the project header area (NOT the chat composer's plus button).\n * Returns true if the dialog appeared.\n */\nexport async function openProjectKnowledgeDialog(page) {\n    const rawOpenResult = unwrapEvaluateResult(await page.evaluate(`\n        (() => {\n            const labels = ${JSON.stringify(PROJECT_ADD_FILES_LABELS)};\n            const isVisible = (el) => {\n                if (!(el instanceof HTMLElement)) return false;\n                const style = window.getComputedStyle(el);\n                if (style.display === 'none' || style.visibility === 'hidden') return false;","sourceCodeStart":2927,"sourceCodeEnd":2963,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/utils.js#L2927-L2963","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the project id (re-list projects) — it may be deleted or mistyped","Check you have access/permission to the project in the logged-in account","Retry once after a short delay to let the SPA finish updating the URL, or wait for the project URL explicitly before verifying","Open the project URL manually in the same profile to see where ChatGPT redirects"],"exampleFix":"// before\nawait page.goto(projectUrl);\nconst id = await ensureChatGPTProjectOpen(page, projectId);\n// after\nawait page.goto(projectUrl);\nawait page.waitForURL(/project/, { timeout: 15000 });\nconst id = await ensureChatGPTProjectOpen(page, projectId);","handlingStrategy":"validation","validationCode":"const state = await getPageState(page);\nif (projectIdFromUrl(state.url) !== projectId) {\n  throw new Error(`project ${projectId} not open; current URL: ${state.url}`);\n}","typeGuard":"function projectIsOpen(state, id) { return !!state?.url && projectIdFromUrl(state.url) === id; }","tryCatchPattern":"try {\n  await openChatGPTProject(page, projectId);\n} catch (e) {\n  if (String(e.message).startsWith('ChatGPT did not open the requested project')) {\n    // re-list projects to confirm the id exists, check permissions, then retry once\n  } else throw e;\n}","preventionTips":["Validate project ids against a fresh project list before opening","Confirm account access/permission to the project","Wait for the SPA to settle (waitForURL on the project path) before verifying the id"],"tags":["chatgpt","navigation","project","url-mismatch"],"backgroundTag":"unexpected-page-navigation","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}