{"record":{"id":"f5af277e3506c787","repo":"jackwener/OpenCLI","slug":"invalid-project-file-path","errorCode":null,"errorMessage":"Invalid project file path","messagePattern":"Invalid project file path","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/project-file-add.js","lineNumber":56,"sourceCode":"            throw new ArgumentError(\n                'chatgpt project-file-add requires at least one file path',\n                'Example: opencli chatgpt project-file-add report.pdf --id 12345678',\n            );\n        }\n\n        const projectId = parseChatGPTProjectId(kwargs.id);\n\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});","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/project-file-add.js#L38-L74","documentation":"ArgumentError thrown when `uploadChatGPTProjectFiles` reports `upload.inputError` but no `upload.reason` — meaning ChatGPT/automation rejected the input (typically an invalid or nonexistent file path or an unusable project id). The default message is 'Invalid project file path'.","triggerScenarios":"`upload.inputError` is truthy after the upload call; the upload helper flagged a user-input problem such as a file that does not exist locally or a malformed project id.","commonSituations":"Typo'd or deleted local file path; passing a directory or URL where a file path is expected; wrong/invalid project ID (not matching /g/g-p-<id>); case-sensitivity issues on the path.","solutions":["Verify each file path exists locally (`ls <path>` / `Test-Path`) before running the command.","Check the project ID: it must be a numeric ID or a /g/g-p-<id> URL.","Re-run with `upload.reason`-reported detail if a reason was provided.","Use absolute paths to avoid working-directory confusion."],"exampleFix":"// before\nopencli chatgpt project-file-add repport.pdf --id abc\n// after (path exists, id is valid)\nopencli chatgpt project-file-add report.pdf --id 12345678","handlingStrategy":"validation","validationCode":"const missing = filePaths.filter(p => !fs.existsSync(p) || !fs.statSync(p).isFile());\nif (missing.length) throw new Error(`Not a valid file path: ${missing.join(', ')}`);\nif (!/^(\\d+|\\/g\\/g-p-\\d+)$/.test(idArg)) throw new Error(`Invalid project id: ${idArg}`);","typeGuard":"function isValidFilePath(p) { return typeof p === 'string' && p.trim() !== '' && fs.existsSync(p) && fs.statSync(p).isFile(); }","tryCatchPattern":"try {\n  await run(['chatgpt', 'project-file-add', ...filePaths, '--id', id]);\n} catch (err) {\n  if (String(err.message).includes('Invalid project file path')) {\n    console.error('Check each path exists and the project id matches /g/g-p-<id>');\n  }\n}","preventionTips":["Use absolute paths and fs.existsSync checks before invoking.","Validate the project ID format (numeric or /g/g-p-<id> URL).","Avoid passing directories or URLs where file paths are expected."],"tags":["argument-validation","file-path","chatgpt","input-error"],"backgroundTag":"invalid-file-path","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}