jackwener/OpenCLI · error · ArgumentError

chatgpt send cannot use --project and --conversation togethe

Error message

chatgpt send cannot use --project and --conversation together

What it means

ArgumentError thrown by `chatgpt send` when both `--project` and `--conversation` are supplied. A project new chat and an existing conversation are mutually exclusive send targets.

Source

Thrown at clis/chatgpt/send.js:43

    navigateBefore: false,
    args: [
        { name: 'prompt', positional: true, required: true, help: 'Prompt to send' },
        { name: 'new', type: 'boolean', default: false, help: 'Start a new chat before sending' },
        { name: 'conversation', valueRequired: true, help: 'Continue an existing ChatGPT conversation ID or /c/<id> URL' },
        { name: 'project', valueRequired: true, help: 'Start a new chat inside a ChatGPT project ID or /g/g-p-<id> URL' },
    ],
    columns: ['Status', 'InjectedText'],
    func: async (page, kwargs) => {
        const prompt = requireNonEmptyPrompt(kwargs.prompt, 'chatgpt send');

        if (normalizeBooleanFlag(kwargs.new) && kwargs.conversation) {
            throw new ArgumentError(
                'chatgpt send cannot use --new and --conversation together',
                'Choose either a new chat or an existing conversation.',
            );
        }
        if (kwargs.project && kwargs.conversation) {
            throw new ArgumentError(
                'chatgpt send cannot use --project and --conversation together',
                'Choose either a project new chat or an existing conversation.',
            );
        }

        if (kwargs.conversation) {
            await openChatGPTConversation(page, kwargs.conversation);
        } else if (kwargs.project) {
            await navigateToProject(page, kwargs.project);
        } else if (normalizeBooleanFlag(kwargs.new)) {
            await startNewChat(page);
        } else {
            await ensureOnChatGPT(page);
        }
        // startNewChat / ensureOnChatGPT now wait for the composer selector
        // after navigating, so the previous standalone 2 s settle is redundant.
        await ensureChatGPTComposer(page, 'ChatGPT send requires a logged-in ChatGPT session with a visible composer.');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Drop --conversation to send a new chat inside the project.
  2. Drop --project to send into the existing conversation.
  3. Audit wrapper scripts that auto-append --project or --conversation.

Example fix

// before
opencli chatgpt send "hello" --project 42 --conversation conv_abc
// after
opencli chatgpt send "hello" --conversation conv_abc
Defensive patterns

Strategy: validation

Validate before calling

const hasProject = args.includes('--project');
const hasConv = args.includes('--conversation');
if (hasProject && hasConv) {
  throw new Error('chatgpt send cannot use --project and --conversation together');
}

Type guard

function flagsAreExclusive(opts) { return !(Boolean(opts.project) && Boolean(opts.conversation)); }

Try / catch

try {
  await run(['chatgpt', 'send', prompt, ...flags]);
} catch (err) {
  if (String(err.message).includes('cannot use --project and --conversation')) {
    console.error('Choose either a project new chat or an existing conversation.');
  }
}

Prevention

When it happens

Trigger: Invoking `opencli chatgpt send "prompt" --project <id> --conversation <id>` so both kwargs.project and kwargs.conversation are set.

Common situations: Script templating that always injects --project; confusion about whether project mode can target an existing conversation; copy-pasted command lines from different examples merged.

Related errors


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