{"record":{"id":"02cad49dc73886b1","repo":"jackwener/OpenCLI","slug":"temporary-chat-did-not-become-visible-after-select","errorCode":null,"errorMessage":"Temporary chat did not become visible after selecting the menu item","messagePattern":"Temporary chat did not become visible after selecting the menu item","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt-app/new.js","lineNumber":47,"sourceCode":"                    '      click menu item \"新的临时聊天\" of menu \"文件\" of menu bar 1',\n                    '    on error',\n                    '      try',\n                    '        click menu item \"新的臨時聊天\" of menu \"檔案\" of menu bar 1',\n                    '      on error',\n                    '        try',\n                    '          click menu item \"New Temporary Chat\" of menu \"File\" of menu bar 1',\n                    '        on error',\n                    '          error \"Unable to locate Temporary Chat menu item. Ensure Accessibility permissions are granted and the language is supported.\"' ,\n                    '        end try',\n                    '      end try',\n                    '    end try',\n                    '  end tell',\n                    'end tell'\n                ].map(line => `-e '${line.replace(/'/g, \"'\\\\''\")}'`).join(' ');\n                execSync(`osascript ${appleScript}`);\n                execSync(\"osascript -e 'delay 0.8'\");\n                if (!isTemporaryChatVisible()) {\n                    throw new CommandExecutionError('Temporary chat did not become visible after selecting the menu item');\n                }\n            } else {\n                execSync(\"osascript -e 'tell application \\\"System Events\\\" to keystroke \\\"n\\\" using command down'\");\n            }\n            return [{ Status: 'Success' }];\n        }\n        catch (err) {\n            if (err instanceof CommandExecutionError) {\n                throw err;\n            }\n            throw new CommandExecutionError(\"Failed to open ChatGPT chat: \" + getErrorMessage(err));\n        }\n    },\n});\n","sourceCodeStart":29,"sourceCodeEnd":62,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt-app/new.js#L29-L62","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Grant the terminal/host app Accessibility and Automation (System Events) permissions in System Settings > Privacy & Security","Update the ChatGPT Desktop app and retry; menu item names may have changed after an app update","Bring the ChatGPT window to the foreground and unlocked before running the command, or rerun the command once more"],"exampleFix":"// before\nexecSync('opencli chatgpt-app new --temp');\n// after\ntry {\n  execSync('opencli chatgpt-app new --temp');\n} catch (e) {\n  execSync(\"osascript -e 'tell application \\\"ChatGPT\\\" to activate'\");\n  execSync('opencli chatgpt-app new --temp'); // retry once after activating\n}","handlingStrategy":"retry","validationCode":"execSync(\"osascript -e 'tell application \\\"ChatGPT\\\" to activate'\");\n// ensure app frontmost and unlocked before selecting the temp-chat menu","typeGuard":null,"tryCatchPattern":"try {\n  execSync('opencli chatgpt-app new --temp');\n} catch (e) {\n  await new Promise(r => setTimeout(r, 2000));\n  execSync(\"osascript -e 'tell application \\\"ChatGPT\\\" to activate'\");\n  execSync('opencli chatgpt-app new --temp'); // retry once after activation\n}","preventionTips":["Grant Accessibility and Automation permissions to the calling terminal app","Keep the ChatGPT Desktop app updated and the screen unlocked during automation","Activate the app explicitly before menu automation and allow extra delay on slow machines"],"tags":["applescript","ui-automation","desktop-app","timeout"],"backgroundTag":"ui-automation-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}