jackwener/OpenCLI · error · CommandExecutionError

quark: Save task timed out

Error message

quark: Save task timed out

What it means

Thrown by clis/quark/save.js when the share-save task created by saveShare never completes during pollTask retries. While polling, the command also captures task.save_as.save_as_sum_num as save_count, but if the task never signals completion, result.success stays false and a CommandExecutionError is raised.

Source

Thrown at clis/quark/save.js:74

            fidList = [...new Set(fids.split(',').map(id => id.trim()).filter(Boolean))];
        }
        const targetFid = toFid || await findFolder(page, to);
        const taskId = await saveShare(page, pwdId, stoken, fidList, targetFid, saveAll);
        const result = {
            success: false,
            task_id: taskId,
            saved_to: to || toFid,
            target_fid: targetFid,
            ...(saveAll ? {} : { fids: fidList }),
        };
        if (taskId) {
            const completed = await pollTask(page, taskId, (task) => {
                result.save_count = task.save_as?.save_as_sum_num;
            });
            result.completed = completed;
            result.success = completed;
            if (!completed)
                throw new CommandExecutionError('quark: Save task timed out');
        }
        else {
            result.success = true;
        }
        return result;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the save command; check whether files actually appeared in the target folder first to avoid duplicates.
  2. Reduce batch size (save specific fids with --fids + --stoken) so the task completes faster.
  3. Verify destination account storage quota is sufficient for the share contents.
  4. Confirm the share link is still valid and the stoken hasn't expired; then retry.
  5. Retry later if Quark's service is degraded.

Example fix

// before
if (!completed)
  throw new CommandExecutionError('quark: Save task timed out');
// after
if (!completed) {
  await new Promise(r => setTimeout(r, 5000));
  result.completed = await pollTask(page, taskId, (task) => {
    result.save_count = task.save_as?.save_as_sum_num;
  });
  if (!result.completed)
    throw new CommandExecutionError('quark: Save task timed out');
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-checks before saving
const targetFree = await getQuota(page);
const shareSize = await estimateShareSize(page);
if (targetFree < shareSize) throw new Error('insufficient quota for save');

Try / catch

try {
  const res = await save(page, args);
} catch (e) {
  if (e.message.includes('Save task timed out')) {
    // check for partial completion, then retry remaining fids
    const existing = await files(page, { fid: targetFid });
    const remaining = diffFids(requestedFids, existing);
    if (remaining.length) await save(page, { ...args, fids: remaining.join(',') });
  } else throw e;
}

Prevention

When it happens

Trigger: Saving large shares where the server-side save_as task takes longer than the polling budget; share link expired or restricted mid-task; Quark backend queue congestion; task permanently failed (e.g. target quota exceeded) so completion never arrives.

Common situations: Bulk-saving big shared folders at peak times; destination drive near storage quota; share link requiring passcode/stoken that became invalid during the operation.

Understand the failure class

Related errors


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