jackwener/OpenCLI · error · CommandExecutionError

TikTok Studio item_list network failure: ${result.networkErr

Error message

TikTok Studio item_list network failure: ${result.networkError}

What it means

The in-page fetch itself completed but the network layer reported a failure (result.networkError is set, e.g. fetch threw TypeError: Failed to fetch, DNS failure, or request blocked). The library surfaces the browser-side network error message verbatim as a CommandExecutionError.

Source

Thrown at clis/tiktok/creator-videos.js:194

        date: formatDate(item.post_time ?? item.create_time ?? item.schedule_time),
        views: normalizeNumber(item.play_count),
        likes: normalizeNumber(item.like_count),
        comments: normalizeNumber(item.comment_count),
        saves: normalizeNumber(item.favorite_count),
        shares: normalizeNumber(item.share_count),
        url,
    };
}

async function fetchCreatorVideosPage(page, cursor, size) {
    const result = await page.evaluate(buildFetchItemListScript(buildItemListRequest(cursor, size))).catch((error) => {
        throw new CommandExecutionError(`Failed to fetch TikTok Studio item_list: ${getErrorMessage(error)}`);
    });
    if (!result || typeof result !== 'object') {
        throw new CommandExecutionError('TikTok Studio item_list returned an unreadable response');
    }
    if (result.networkError) {
        throw new CommandExecutionError(`TikTok Studio item_list network failure: ${result.networkError}`);
    }
    if (result.status === 401 || result.status === 403) {
        throw new AuthRequiredError('www.tiktok.com', `TikTok Studio item_list requires login (HTTP ${result.status})`);
    }
    if (!result.ok) {
        const detail = result.parseError
            ? `invalid JSON (${result.parseError})`
            : `HTTP ${result.status || 0}${result.statusText ? ` ${result.statusText}` : ''}`;
        throw new CommandExecutionError(`TikTok Studio item_list failed: ${detail}`, result.text ? `Response preview: ${result.text}` : undefined);
    }
    const payload = unwrapPayload(result.data);
    assertApiSuccess(payload);
    return payload;
}

async function listCreatorVideos(page, args) {
    const limit = requirePositiveInt(args.limit, 'limit', DEFAULT_LIMIT, MAX_LIMIT);
    let nextCursor = requireCursor(args.cursor);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Use the networkError text to identify the exact network-layer cause (DNS, blocked, reset)
  2. Check general connectivity to www.tiktok.com in the same Chrome profile
  3. Disable conflicting proxies/VPN or configure the browser's proxy correctly
  4. Retry after a delay; if your IP is rate-limited/flagged, switch network or wait
  5. Catch CommandExecutionError and implement backoff retry for transient failures

Example fix

// before
if (result.networkError) throw new CommandExecutionError(`... ${result.networkError}`);
// after (caller)
try {
  rows = await listCreatorVideos(page, opts);
} catch (e) {
  if (/network/i.test(e.message)) { await sleep(5000); rows = await listCreatorVideos(page, opts); }
  else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

await fetch('https://www.tiktok.com', { method: 'HEAD' }).catch(() => { throw new Error('No connectivity to tiktok.com'); });

Type guard

function hasNetworkError(r) { return !!r && typeof r === 'object' && typeof r.networkError === 'string'; }

Try / catch

try {
  rows = await listCreatorVideos(page, opts);
} catch (e) {
  if (/network failure/.test(e.message)) {
    await sleep(5000); rows = await listCreatorVideos(page, opts);
  } else throw e;
}

Prevention

When it happens

Trigger: result.networkError truthy: the item_list XHR/fetch failed at the network level — connection reset, CORS/blocked request, TLS error, offline machine, or TikTok's edge dropping the request.

Common situations: Corporate proxy or firewall blocking tiktok API endpoints, VPN/IP flagged by TikTok, IPv6 issues, or running while the machine's network dropped.

Related errors


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