jackwener/OpenCLI · error · CommandExecutionError
Credits Usage not visible
Error message
Credits Usage not visible
What it means
The Qoder 'credits' UI command clicks a visible 'Credits Usage' element to open the credits popover, then scrapes whatever dialog/popover appears. If the click script reports no matching visible element ({ok:false}), it throws CommandExecutionError('Credits Usage not visible'). The message means the credits entry point was not found/clickable in the Qoder UI.
Source
Thrown at clis/qoder/ui.js:185
if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Marketplace button not found', '');
return [{ Status: 'clicked' }];
},
});
// -------- credits --------
cli({
site: 'qoder',
name: 'credits',
access: 'read',
description: 'Click "Credits Usage" and return the credits-usage display text.',
domain: 'localhost',
strategy: Strategy.UI,
browser: true,
args: [],
columns: ['Field', 'Value'],
func: async (page) => {
const res = await evaluateQoder(page, clickByTextScript(['Credits Usage']));
if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Credits Usage not visible', '');
await page.wait(0.5);
// Try to read whatever appears.
const info = await evaluateQoder(page, `(() => {
${IS_VISIBLE_JS}
// Find any dialog/popover that appeared.
const popovers = Array.from(document.querySelectorAll('[role="dialog"], [class*="popover"i], [class*="popup"i]')).filter(isVisible);
if (!popovers.length) return null;
const pop = popovers[popovers.length - 1];
return (pop.innerText || pop.textContent || '').trim().replace(/\\s+/g, ' ').slice(0, 600);
})()`);
try { await page.evaluate(`document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));`); } catch {}
return [
{ Field: 'Status', Value: 'clicked' },
{ Field: 'Info', Value: info || '(no popover detected after click)' },
];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Make sure you are signed into Qoder and the window is visible, then retry the credits command.
- Increase the pre-click wait so the status bar finishes rendering.
- Dismiss any open dialogs covering the status bar.
- Check the live label via CDP DevTools and update the 'Credits Usage' pattern in clis/qoder/ui.js if it changed.
- Retry once after a short delay — transitive render timing is a common cause.
Example fix
// before
const res = await evaluateQoder(page, clickByTextScript(['Credits Usage']));
// after: retry with wait before failing
let res = await evaluateQoder(page, clickByTextScript(['Credits Usage', 'Credits', 'Usage']));
if (!res?.ok) { await page.wait(2); res = await evaluateQoder(page, clickByTextScript(['Credits Usage', 'Credits', 'Usage'])); } Defensive patterns
Strategy: validation
Validate before calling
async function creditsWidgetPresent(page) {
const probe = await page.evaluate(`(() => {
const el = Array.from(document.querySelectorAll('button, [role="button"], a, span, div'))
.find(e => (e.innerText||'').toLowerCase().includes('credits'));
return !!el && el.getBoundingClientRect().width > 0;
})()`);
if (probe !== true) throw new Error('Credits widget not rendered — sign in / wait for UI');
} Type guard
function isClickResult(res) {
return res !== null && typeof res === 'object' && typeof res.ok === 'boolean';
} Try / catch
try {
await cli.run(['qoder', 'credits']);
} catch (e) {
if (String(e.message).includes('Credits Usage not visible')) {
console.error('Credits widget unavailable: check Qoder sign-in state and UI load.');
} else throw e;
} Prevention
- Confirm you are signed in to Qoder before querying credits
- Increase the pre-click wait on slow machines
- Verify the exact rendered label after Qoder updates
- Run commands against a visible (non-minimized) window
When it happens
Trigger: Running 'credits' when the status-bar 'Credits Usage' item is not rendered (UI still loading), hidden behind a modal, its label changed, or the text lives in a non-clickable element that clickByTextScript does not scan.
Common situations: Account not signed in so the credits widget is absent; Qoder version change moved the label (e.g. 'Usage' vs 'Credits Usage'); window minimized so rects are zero-size and isVisible fails; slow startup — command issued before the status bar mounted.
Related errors
- Knowledge button not found
- Marketplace button not found
- View all button not visible
- Add Workspace button not found
- More Actions button not found
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/dc211f750d34ff39.
Report an issue: GitHub.