jackwener/OpenCLI · error · Error

No live streams returned${suffix}

Error message

No live streams returned${suffix}

What it means

The live command collects live streams via TikTok's live-discover API; if zero unique rows are gathered, the script throws 'No live streams returned'. An API failure on the pages is appended as '(live-discover API failed: ...)' so the caller can tell an API breakdown from genuinely no live streams.

Source

Thrown at clis/tiktok/live.js:98

      for (const entry of list) {
        const row = normalizeLiveItem(entry, dedup.size + 1);
        if (row) {
          const key = row.streamer || row.url;
          if (key && !dedup.has(key)) dedup.set(key, row);
        }
      }
    } catch (error) {
      apiFailure = error instanceof Error ? error.message : String(error);
    }
  }

  const rows = Array.from(dedup.values())
    .slice(0, limit)
    .map((row, index) => ({ ...row, index: index + 1 }));

  if (rows.length === 0) {
    const suffix = apiFailure ? ' (live-discover API failed: ' + apiFailure + ')' : '';
    throw new Error('No live streams returned' + suffix);
  }
  return rows;
})()
`;
}

async function listLive(page, args) {
    const limit = requireLimit(args.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });
    await page.goto('https://www.tiktok.com/live', { waitUntil: 'load', settleMs: 5000 });
    let rows;
    try {
        rows = await page.evaluate(buildLiveScript(limit));
    } catch (error) {
        throwTikTokPageContextError(error, {
            authMessage: 'TikTok requires browser access to load live streams',
            emptyPattern: /No live streams returned/,
            emptyTarget: 'tiktok live',
            failureMessage: 'Failed to load TikTok live streams',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the '(live-discover API failed: ...)' suffix to diagnose the underlying API error.
  2. Refresh cookies/msToken and retry — live discovery endpoints are strict about signed requests.
  3. Retry later; live inventory changes minute to minute, so an empty result may be transient.
  4. Confirm in a browser that tiktok.com/live shows streams for your region/account.
  5. If truly no streams exist for the query, catch this error and handle it as an empty list.
Defensive patterns

Strategy: try-catch

Type guard

function isLiveEmpty(e) {
  return e instanceof Error && e.message.startsWith('No live streams returned');
}
function hadApiFailure(e) { return /live-discover API failed:/.test(e?.message || ''); }

Try / catch

try {
  rows = await liveCommand({ limit });
} catch (e) {
  if (isLiveEmpty(e)) {
    if (hadApiFailure(e)) await sleep(30_000); // retry after API failure
    else rows = []; // genuinely no live streams now
  } else throw e;
}

Prevention

When it happens

Trigger: The live-discover endpoint returned an empty list for the queried scope; the first page fetch failed (assertTikTokApiSuccess or fetchJson error) setting apiFailure; msToken/signature missing causing rejected requests.

Common situations: Region where TikTok Live discovery returns nothing; no live streams matching the current query at that moment; TikTok rate-limiting live-discover from automated traffic; signed-request failures due to missing msToken cookie.

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/6c5b993d112f8b46. Report an issue: GitHub.