jackwener/OpenCLI · error · CommandExecutionError

TikTok Studio item_list failed: ${statusMsg || statusCode}

Error message

TikTok Studio item_list failed: ${statusMsg || statusCode}

What it means

When item_list returns a non-zero status_code whose message does NOT look like an auth problem, assertApiSuccess throws CommandExecutionError including the server's status_msg or code. This surfaces TikTok-side business errors (bad parameters, internal errors, account restrictions) rather than masking them.

Source

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

function looksAuthFailure(message) {
    return /\b(auth|login|log in|permission|unauthori[sz]ed|forbidden)\b/i.test(message);
}

function unwrapPayload(data) {
    if (!data || typeof data !== 'object') {
        throw new CommandExecutionError('TikTok Studio item_list returned an empty response');
    }
    return data.data && typeof data.data === 'object' ? data.data : data;
}

function assertApiSuccess(data) {
    const statusCode = data.status_code ?? data.statusCode;
    const statusMsg = String(data.status_msg ?? data.statusMsg ?? '').trim();
    if (statusCode !== undefined && Number(statusCode) !== 0) {
        if (looksAuthFailure(statusMsg)) {
            throw new AuthRequiredError('www.tiktok.com', `TikTok Studio item_list requires login: ${statusMsg || statusCode}`);
        }
        throw new CommandExecutionError(`TikTok Studio item_list failed: ${statusMsg || statusCode}`);
    }
    if (statusMsg && !/^(success|ok)$/i.test(statusMsg)) {
        if (looksAuthFailure(statusMsg)) {
            throw new AuthRequiredError('www.tiktok.com', `TikTok Studio item_list requires login: ${statusMsg}`);
        }
        throw new CommandExecutionError(`TikTok Studio item_list failed: ${statusMsg}`);
    }
}

function normalizeNumber(value) {
    const n = Number(value);
    return Number.isFinite(n) ? n : 0;
}

function formatDate(value) {
    const seconds = Number(value);
    if (!Number.isFinite(seconds) || seconds <= 0) return '';
    return new Date(seconds * 1000).toLocaleString('zh-CN', {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the appended statusMsg/statusCode in the message to identify the server-side cause.
  2. Back off and retry with exponential delay if the message suggests rate limiting.
  3. Verify the target creator/user parameters are correct.
  4. Check TikTok service status; retry later if it's a server-side error.

Example fix

// before
await fetchCreatorVideosPage(...); // throws 'TikTok Studio item_list failed: rate limit exceeded'
// after
try {
  await fetchCreatorVideosPage(...);
} catch (e) {
  if (String(e.message).includes('failed:')) {
    await sleep(5000); // back off before retry
    await fetchCreatorVideosPage(...);
  } else throw e;
}
Defensive patterns

Strategy: retry

Try / catch

try {
  const videos = await listCreatorVideos(opts);
} catch (e) {
  const msg = String(e.message);
  if (msg.includes('item_list failed:') && /rate|busy|limit/i.test(msg)) {
    await sleep(5000 * attempt);
    return listCreatorVideos(opts);
  }
  throw e;
}

Prevention

When it happens

Trigger: item_list responds with statusCode != 0 and status_msg such as 'rate limit exceeded', 'invalid params', or an internal error code — anything not matching the auth regex.

Common situations: Hammering the endpoint past rate limits; requesting a user whose videos are private/deleted; TikTok API incident; passing a user name the studio endpoint cannot resolve.

Related errors


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