jackwener/OpenCLI · warning · EmptyResultError

No option greeks were returned for ${symbol}. Confirm the sy

Error message

No option greeks were returned for ${symbol}. Confirm the symbol, expiration, and Barchart login state.

What it means

An EmptyResultError thrown when the Barchart greeks request succeeded and `data.rows` is an array, but it contains zero rows. The library surfaces this to tell the user the lookup completed yet matched no option greeks, and hints that symbol, expiration, or login state may be at fault.

Source

Thrown at clis/barchart/greeks.js:174

      })()
    `));
        if (!data || data.ok !== true) {
            if (data?.reason === 'http') {
                throw new CommandExecutionError(`Barchart greeks request failed: HTTP ${data.status}${data.statusText ? ` ${data.statusText}` : ''}`);
            }
            if (data?.reason === 'malformed') {
                throw new CommandExecutionError(`Barchart greeks returned an unreadable options payload${data.message ? `: ${data.message}` : ''}`);
            }
            if (data?.reason === 'exception') {
                throw new CommandExecutionError(`Barchart greeks request failed: ${data.message || 'unknown error'}`);
            }
            throw new CommandExecutionError(`Failed to fetch Barchart greeks for ${symbol}`);
        }
        if (!Array.isArray(data.rows)) {
            throw new CommandExecutionError('Barchart greeks returned an unreadable options payload');
        }
        if (data.rows.length === 0) {
            throw new EmptyResultError('barchart greeks', `No option greeks were returned for ${symbol}. Confirm the symbol, expiration, and Barchart login state.`);
        }
        return data.rows.map(r => {
            if (!r || typeof r !== 'object' || Array.isArray(r)) {
                throw new CommandExecutionError('Barchart greeks returned a malformed option row');
            }
            const type = String(r.type || '').trim();
            const expirationValue = String(r.expiration || '').trim();
            if (!/^(call|put)$/i.test(type) || r.strike === undefined || r.strike === null || r.strike === '' || !expirationValue) {
                throw new CommandExecutionError('Barchart greeks returned a malformed option row identity');
            }
            return {
                type,
                strike: r.strike,
                last: r.last != null ? Number(Number(r.last).toFixed(2)) : null,
                iv: r.iv != null ? Number(Number(r.iv).toFixed(2)) + '%' : null,
                delta: r.delta != null ? Number(Number(r.delta).toFixed(4)) : null,
                gamma: r.gamma != null ? Number(Number(r.gamma).toFixed(4)) : null,
                theta: r.theta != null ? Number(Number(r.theta).toFixed(4)) : null,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run with a valid future expiration date for the symbol.
  2. Confirm the symbol has listed options (try a liquid ticker like SPY).
  3. Re-login to Barchart; an invalid session can yield empty rows.
  4. Check the market is open / chain data is published for that date.

Example fix

// before
await cli.run(['barchart','greeks','OLDTICKER','--expiration','2020-01-17']);
// after
await cli.run(['barchart','greeks','SPY','--expiration','2026-09-18']);
Defensive patterns

Strategy: validation

Validate before calling

function validateGreeksRequest(symbol, expiration){
  if (!/^[A-Z.]{1,6}$/.test(symbol)) throw new Error('bad symbol');
  if (expiration && new Date(expiration) <= new Date()) throw new Error('expiration is in the past');
}

Type guard

const hasOptionsListed = (symbol) => /^[A-Z]{1,5}$/.test(symbol); // liquid US symbol heuristic

Try / catch

try {
  const rows = await cli.run(['barchart','greeks', symbol, '--expiration', exp]);
} catch (e) {
  if (e.name === 'EmptyResultError') {
    console.warn(`No greeks for ${symbol} @ ${exp}; try another expiration or check login state`);
  }
}

Prevention

When it happens

Trigger: `barchart greeks SYMBOL --expiration <date>` where the expiration has passed, the symbol has no options chain, or Barchart silently returns an empty rows list because the session is not authenticated.

Common situations: Querying expired option expirations, misspelled or OTC symbols without listed options, weekends/holdiays with no chain snapshot, expired Barchart login yielding an empty-but-valid payload.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/0ce07a2f0970530e. Report an issue: GitHub.