jackwener/OpenCLI · error · CommandExecutionError

Temporary chat did not become visible after selecting the me

Error message

Temporary chat did not become visible after selecting the menu item

What it means

After scripting the ChatGPT Desktop app to select the 'New Temporary Chat' menu item via osascript, the library waits and then calls isTemporaryChatVisible() to verify the temporary-chat UI actually appeared. If verification fails, it throws this CommandExecutionError rather than reporting success for an action that did not happen.

Source

Thrown at clis/chatgpt-app/new.js:47

                    '      click menu item "新的临时聊天" of menu "文件" of menu bar 1',
                    '    on error',
                    '      try',
                    '        click menu item "新的臨時聊天" of menu "檔案" of menu bar 1',
                    '      on error',
                    '        try',
                    '          click menu item "New Temporary Chat" of menu "File" of menu bar 1',
                    '        on error',
                    '          error "Unable to locate Temporary Chat menu item. Ensure Accessibility permissions are granted and the language is supported."' ,
                    '        end try',
                    '      end try',
                    '    end try',
                    '  end tell',
                    'end tell'
                ].map(line => `-e '${line.replace(/'/g, "'\\''")}'`).join(' ');
                execSync(`osascript ${appleScript}`);
                execSync("osascript -e 'delay 0.8'");
                if (!isTemporaryChatVisible()) {
                    throw new CommandExecutionError('Temporary chat did not become visible after selecting the menu item');
                }
            } else {
                execSync("osascript -e 'tell application \"System Events\" to keystroke \"n\" using command down'");
            }
            return [{ Status: 'Success' }];
        }
        catch (err) {
            if (err instanceof CommandExecutionError) {
                throw err;
            }
            throw new CommandExecutionError("Failed to open ChatGPT chat: " + getErrorMessage(err));
        }
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Grant the terminal/host app Accessibility and Automation (System Events) permissions in System Settings > Privacy & Security
  2. Update the ChatGPT Desktop app and retry; menu item names may have changed after an app update
  3. Bring the ChatGPT window to the foreground and unlocked before running the command, or rerun the command once more

Example fix

// before
execSync('opencli chatgpt-app new --temp');
// after
try {
  execSync('opencli chatgpt-app new --temp');
} catch (e) {
  execSync("osascript -e 'tell application \"ChatGPT\" to activate'");
  execSync('opencli chatgpt-app new --temp'); // retry once after activating
}
Defensive patterns

Strategy: retry

Validate before calling

execSync("osascript -e 'tell application \"ChatGPT\" to activate'");
// ensure app frontmost and unlocked before selecting the temp-chat menu

Try / catch

try {
  execSync('opencli chatgpt-app new --temp');
} catch (e) {
  await new Promise(r => setTimeout(r, 2000));
  execSync("osascript -e 'tell application \"ChatGPT\" to activate'");
  execSync('opencli chatgpt-app new --temp'); // retry once after activation
}

Prevention

When it happens

Trigger: `chatgpt-app new --temp` on macOS where the menu click/keystroke did not take effect: app UI changed, menu item renamed, app window not frontmost, accessibility permissions denied, or UI renders slower than the 0.8s delay plus isTemporaryChatVisible's polling window.

Common situations: ChatGPT Desktop app updated its menu structure; Automation/Accessibility permissions not granted to the terminal; running while the screen is locked or the app is minimized to tray; slow machine making the fixed delay too short.

Related errors


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