{"record":{"id":"4756d1dc9e801029","repo":"jackwener/OpenCLI","slug":"add-workspace-button-not-found","errorCode":null,"errorMessage":"Add Workspace button not found","messagePattern":"Add Workspace button not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/qoder/ui.js","lineNumber":235,"sourceCode":"        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'View all button not visible', '');\n        return [{ Status: 'clicked' }];\n    },\n});\n\n// -------- add-workspace --------\ncli({\n    site: 'qoder',\n    name: 'add-workspace',\n    access: 'write',\n    description: 'Click \"Add Workspace\" — opens the folder picker. Note: this opens a system file-picker dialog that Qoder controls; the actual folder selection must be done in the UI by the user.',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: ['Status'],\n    func: async (page) => {\n        const res = await evaluateQoder(page, clickByTextScript(['Add Workspace']));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Add Workspace button not found', '');\n        return [{ Status: 'clicked — folder picker opened (manual selection required)' }];\n    },\n});\n\n// -------- account --------\ncli({\n    site: 'qoder',\n    name: 'account',\n    access: 'read',\n    description: 'Click the account button (username) in the Qoder sidebar and return the visible account dropdown items.',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'username', required: false, help: 'Username text shown in the sidebar (default: tries common short labels)' },\n    ],\n    columns: ['Field', 'Value'],\n    func: async (page, kwargs) => {","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/qoder/ui.js#L217-L253","documentation":"The Qoder 'add-workspace' UI command clicks a visible element containing 'Add Workspace' to open the folder picker. If the click script finds no matching visible element ({ok:false}), it throws CommandExecutionError('Add Workspace button not found'). It indicates the Add Workspace affordance was absent from the rendered Qoder DOM.","triggerScenarios":"Running 'add-workspace' when a workspace is already open and the button is hidden, the welcome/explorer panel is collapsed, the UI has not finished loading, or the label changed in a newer Qoder build.","commonSituations":"Qoder already has a folder open so the button shows different text ('Open Folder', a folder icon); welcome page dismissed; window minimized giving zero-size rects; version change removed the literal 'Add Workspace' label.","solutions":["Open Qoder with no folder (welcome state) or open the Explorer panel so the Add Workspace button is visible, then retry.","Add a startup wait and re-run the command.","Try alternate labels ('Add Workspace Folder', 'Open Folder') by extending the pattern list.","Verify the actual DOM label via CDP DevTools and update clis/qoder/ui.js.","Confirm the CDP session is attached to the main window (port 9237), not another target."],"exampleFix":"// before\nclickByTextScript(['Add Workspace'])\n// after: include likely variants\nclickByTextScript(['Add Workspace', 'Add workspace folder', 'Open Folder'])","handlingStrategy":"fallback","validationCode":"async function addWorkspaceReachable(page) {\n  const probe = await page.evaluate(`(() => {\n    const texts = Array.from(document.querySelectorAll('button, [role=\"button\"], a'))\n      .map(b => (b.innerText||'').toLowerCase());\n    return texts.some(t => t.includes('add workspace') || t.includes('open folder'));\n  })()`);\n  return probe === true;\n}","typeGuard":"function isClickResult(res) {\n  return res !== null && typeof res === 'object' && typeof res.ok === 'boolean';\n}","tryCatchPattern":"try {\n  await cli.run(['qoder', 'add-workspace']);\n} catch (e) {\n  if (String(e.message).includes('Add Workspace button not found')) {\n    // fallback: use the menu path instead\n    await cli.run(['qoder', 'more-actions']);\n  } else throw e;\n}","preventionTips":["Run add-workspace from Qoder's welcome (no-folder) state where the button is shown","Open the Explorer panel if Qoder starts with it collapsed","Try alternate label variants ('Open Folder') when the welcome state is unavailable","Keep the Qoder version stable in CI to avoid label drift"],"tags":["ui-automation","electron","cdp","selector-not-found"],"backgroundTag":"ui-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}