jackwener/OpenCLI · info
Command returned an empty result.
Error message
Command returned an empty result.
What it means
The commander adapter warns when a command handler resolves to an empty result — either null/undefined or an empty array — while verbose output is enabled and no explicit format was chosen. The command still renders (empty table/output); this warning just tells the developer the site command produced no data.
Source
Thrown at src/commanderAdapter.ts:134
const result = await executeCommand(cmd, kwargs, verbose, {
prepared: true,
...(typeof globals.profile === 'string' && globals.profile.trim() ? { profile: globals.profile.trim() } : {}),
...(typeof optionsRecord.trace === 'string' && optionsRecord.trace !== 'off' ? { trace: optionsRecord.trace } : {}),
...(cmd.browser && typeof optionsRecord.window === 'string' ? { windowMode: optionsRecord.window } : {}),
...(cmd.browser && typeof optionsRecord.siteSession === 'string' ? { siteSession: optionsRecord.siteSession } : {}),
...(cmd.browser && typeof optionsRecord.keepTab === 'string' ? { keepTab: optionsRecord.keepTab } : {}),
});
if (result === null || result === undefined) {
return;
}
const resolved = getRegistry().get(fullName(cmd)) ?? cmd;
if (!formatExplicit && format === 'table' && resolved.defaultFormat) {
format = resolved.defaultFormat;
}
if (verbose && (!result || (Array.isArray(result) && result.length === 0))) {
log.warn('Command returned an empty result.');
}
renderOutput(result, {
fmt: format,
fmtExplicit: formatExplicit,
columns: resolved.columns,
title: `${resolved.site}/${resolved.name}`,
elapsed: (Date.now() - startTime) / 1000,
source: fullName(resolved),
footerExtra: resolved.footerExtra?.(kwargs),
});
} catch (err) {
renderError(err, fullName(cmd), optionsRecord.verbose === true, optionsRecord.trace);
process.exitCode = resolveExitCode(err);
}
});
}
// ── Exit code resolution ─────────────────────────────────────────────────────View on GitHub (pinned to 49907e53dc)
Solutions
- Check whether the result is legitimately empty (no matching rows on the site) — then the warning is expected.
- Loosen or remove filters/limits passed to the command and rerun.
- If results exist on the site but the CLI shows empty, inspect the site command handler for a missing return statement.
- Verify authentication/session state for that site; an auth-walled empty response can look like an empty result.
Example fix
// before
async function listItems() {
const items = await fetchItems();
// missing return -> empty result warning
}
// after
async function listItems() {
const items = await fetchItems();
return items;
} Defensive patterns
Strategy: validation
Validate before calling
const result = await runCommand(args);
const empty = result == null || (Array.isArray(result) && result.length === 0);
if (empty) console.error('Command produced no data — check filters or auth before parsing output.'); Type guard
function hasRows<T>(r: T[] | null | undefined): r is T[] {
return Array.isArray(r) && r.length > 0;
} Prevention
- Confirm the site actually has data before debugging empty results.
- Always return collected results from command handlers.
- Run with --verbose to surface the empty-result warning during development.
When it happens
Trigger: Running any registered command with --verbose where the handler returned undefined/null or returned [] — e.g. a listing command whose site returned no rows.
Common situations: Querying a site/account that genuinely has no data; a filter that matches nothing; a handler bug that forgets to return its collected results; site-side empty pages.
Related errors
- No prices returned for train_no=${trainNo} ${fromStation.nam
- No 12306 stations match "${keyword}"
- CoinGecko returned no category data.
- coingecko top
- coingecko returned no trending coins.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/de121fd25b724914.
Report an issue: GitHub.