jackwener/OpenCLI · error · ArgumentError
keyword cannot be empty
Error message
keyword cannot be empty
What it means
Thrown as an ArgumentError when the --keyword option for the marketplace search command is missing, empty, or whitespace-only. Search requires a non-empty query before typing into the marketplace search input.
Source
Thrown at clis/trae-solo/skill.js:115
// -------- skill-search --------
cli({
site: 'trae-solo',
name: 'skill-search',
access: 'read',
description: 'Filter Skills Marketplace by keyword.',
domain: 'localhost',
strategy: Strategy.UI,
browser: true,
args: [
{ name: 'keyword', positional: true, required: true, help: 'Search keyword (substring)' },
{ name: 'limit', type: 'int', required: false, default: 50, help: 'Max rows' },
],
columns: ['Index', 'Name', 'Description'],
func: async (page, kwargs) => {
await switchToPanel(page, 'Skills');
await ensureSkillsTab(page, 'Skills Marketplace');
const keyword = String(kwargs.keyword || '').trim();
if (!keyword) throw new ArgumentError('keyword cannot be empty');
const kwJson = JSON.stringify(keyword);
await page.evaluate(`(function() {
const inp = document.querySelector('input[placeholder="Search"]');
if (!inp) return;
inp.focus();
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
setter.call(inp, ${kwJson});
inp.dispatchEvent(new Event('input', { bubbles: true }));
})()`);
await page.wait(0.7);
const items = await page.evaluate(`(function() {
const cards = Array.from(document.querySelectorAll('.marketplace-card-v2')).filter((c) => c.offsetParent);
return cards.map((c, i) => {
const logo = c.querySelector('.skill-logo-svg');
const name = (logo && logo.getAttribute('aria-label')) || '';
const full = (c.innerText || '').replace(/\\s+/g, ' ').trim();View on GitHub (pinned to 49907e53dc)
Solutions
- Pass a non-empty keyword, e.g. --keyword "code review".
- Guard the value in scripts before calling: if (!kw.trim()) throw/skip.
- Check shell quoting so the keyword isn't consumed as a separate flag.
Example fix
// before
await skillSearch({ keyword: '' })
// after
await skillSearch({ keyword: 'react' }) Defensive patterns
Strategy: validation
Validate before calling
function requireKeyword(kwargs) {
const kw = String(kwargs.keyword || '').trim();
if (!kw) throw new Error('Pass --keyword "<search term>"');
return kw;
} Type guard
function isNonEmptyKeyword(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
await skillSearch({ keyword: kw });
} catch (e) {
if (e instanceof ArgumentError && /keyword cannot be empty/.test(e.message)) {
// prompt for a keyword or abort the workflow
} else throw e;
} Prevention
- Always pass --keyword with a quoted value.
- Trim and check the keyword in scripts before invoking.
- Beware shell quoting that swallows the argument.
When it happens
Trigger: Calling the skill-search command without kwargs.keyword, or with keyword="" / " ".
Common situations: Scripted invocations where the keyword variable is unset or empty; user forgot the --keyword flag; quoting issues in shell causing the value to be dropped.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Invalid --from username: ${JSON.stringify(kwargs.from)}
- twitter search query is empty
- ${label} cannot be empty
- bbc topic "${args.topic}" is not supported
- bbc ${label} must be a positive integer
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/99871f828f852475.
Report an issue: GitHub.