{"record":{"id":"983445c6a63cd63a","repo":"jackwener/OpenCLI","slug":"failed-to-upload-file-to-chatgpt-project-knowledge-983445","errorCode":null,"errorMessage":"Failed to upload file to ChatGPT project knowledge","messagePattern":"Failed to upload file to ChatGPT project knowledge","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/project-file-add.js","lineNumber":63,"sourceCode":"\n        let upload;\n        try {\n            upload = await uploadChatGPTProjectFiles(page, projectId, filePaths);\n        } catch (err) {\n            throw new CommandExecutionError(\n                `Failed to upload file to ChatGPT project knowledge: ${err instanceof Error ? err.message : String(err)}`,\n            );\n        }\n\n        if (upload?.inputError) {\n            throw new ArgumentError(\n                upload.reason || 'Invalid project file path',\n                'Provide an existing local file path that ChatGPT project knowledge can upload.',\n            );\n        }\n\n        if (!upload?.ok) {\n            throw new CommandExecutionError(\n                upload?.reason || 'Failed to upload file to ChatGPT project knowledge',\n                `Open ${CHATGPT_URL}/g/g-p-${projectId} and verify the project accepts file uploads. If your browser needs a proxy, configure it outside this command.`,\n            );\n        }\n\n        return upload.files.map(file => ({\n            Status: '📄 uploaded to project knowledge',\n            File: file,\n        }));\n    },\n});\n","sourceCodeStart":45,"sourceCodeEnd":75,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/project-file-add.js#L45-L75","documentation":"CommandExecutionError thrown when the upload result is neither an input error nor `ok` — the upload helper finished but reported a non-input failure (via `upload.reason`) or returned nothing usable. It indicates the ChatGPT project knowledge upload did not complete.","triggerScenarios":"`uploadChatGPTProjectFiles` resolves with `ok: false` (or an undefined/empty upload) after the input checks pass.","commonSituations":"ChatGPT rejected the file (size/format limits); project page failed to accept uploads; browser needs a proxy configured outside the command; session expired mid-flow; DOM changes broke the post-upload confirmation detection.","solutions":["Open https://chatgpt.com/g/g-p-<projectId> manually and confirm the project accepts file uploads.","Check upload.reason in the error detail for the specific failure.","Verify file meets ChatGPT size/type limits and re-upload.","Configure browser proxy outside this command if networking requires one; ensure a fresh logged-in session."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm project page is usable before upload\nconst ok = await page.goto(`https://chatgpt.com/g/g-p-${projectId}`).then(r => r.ok()).catch(() => false);\nif (!ok) throw new Error(`Project page /g/g-p-${projectId} not reachable; check login/proxy`);","typeGuard":"function uploadSucceeded(u) { return u !== null && typeof u === 'object' && u.ok === true && Array.isArray(u.files); }","tryCatchPattern":"try {\n  await run(['chatgpt', 'project-file-add', ...filePaths, '--id', id]);\n} catch (err) {\n  if (String(err.message).includes('Failed to upload file to ChatGPT project knowledge')) {\n    console.error(`Open https://chatgpt.com/g/g-p-${id} and verify the project accepts uploads; configure proxy outside the command if needed.`);\n  }\n}","preventionTips":["Manually verify the project accepts uploads before automating.","Keep file sizes/types within ChatGPT limits.","Configure browser proxies outside this command.","Refresh the login session if uploads stall."],"tags":["chatgpt","upload","browser-automation","command-execution"],"backgroundTag":"automation-upload-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}