jackwener/OpenCLI · error · CommandExecutionError
Twitter likes resume file ${filePath} is already marked comp
Error message
Twitter likes resume file ${filePath} is already marked complete What it means
When a Twitter likes archive finishes, the CLI marks its resume file with complete: true. readResumeFile rejects resume files already marked complete because there is nothing left to resume — the fetch already produced a full archive. Throwing prevents accidentally re-running a job that already succeeded.
Source
Thrown at clis/twitter/likes.js:151
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)
|| !Number.isInteger(count) || count < 0
|| (parsed.cursor != null && typeof parsed.cursor !== 'string')
|| (cursor !== null && !cursor.trim())) {
throw new CommandExecutionError(`Twitter likes resume file ${filePath} has an invalid shape`);
}
if (expected) {
if (parsed.source !== expected.source)
throw new ArgumentError(`Resume file source mismatch: expected ${expected.source}, found ${parsed.source || 'unknown'}`);
if (String(parsed.username || '').toLowerCase() !== String(expected.username).toLowerCase())
throw new ArgumentError(`Resume file username mismatch: expected @${expected.username}, found @${parsed.username || 'unknown'}`);
if (outputFile !== expected.outputFile)
throw new ArgumentError(`Resume file output mismatch: expected ${expected.outputFile || 'in-memory mode'}, found ${outputFile || 'in-memory mode'}`);
if (!expected.outputFile && !Array.isArray(parsed.tweets))
throw new CommandExecutionError(`Twitter likes resume file ${filePath} is missing in-memory tweets`);
if (!expected.outputFile && parsed.tweets.length !== count)
throw new CommandExecutionError(`Twitter likes resume file ${filePath} count does not match its in-memory tweets`);
if (parsed.complete)
throw new CommandExecutionError(`Twitter likes resume file ${filePath} is already marked complete`);
}
return {
cursor,
count,
tweets: Array.isArray(parsed.tweets) ? parsed.tweets : [],
username: parsed.username || null,
complete: Boolean(parsed.complete),
source: parsed.source || null,
outputFile,
updatedAt: parsed.updatedAt || null,
};
}
// Keep this in sync with twitter/bookmarks; wording is command-specific, so the
// atomic tmp-write/rename cleanup sequence intentionally remains local.
function writeResumeFile(filePath, payload) {
if (!filePath)
return;View on GitHub (pinned to 49907e53dc)
Solutions
- Do not resume — the archive is complete; reuse the previously generated output archive.
- If you truly want a fresh full fetch, delete the resume file (or point --resume-file at a new path) and re-run.
- Check parsed.complete in the resume JSON before scripting retries; skip runs whose resume file is complete.
Example fix
// before: shell retry loop resumes a completed job opencli twitter likes @jack --all --resume-file likes.json --output-file likes.ndjson // after: skip if already complete jq -e '.complete == true' likes.json && echo 'already complete' || opencli twitter likes @jack --all --resume-file likes.json --output-file likes.ndjson
Defensive patterns
Strategy: validation
Validate before calling
const state = JSON.parse(fs.readFileSync(resumePath, 'utf8'));
if (state.complete) {
console.log('Archive already complete; skipping.');
process.exit(0);
} Type guard
function isResumable(state) {
return typeof state === 'object' && state !== null && state.complete !== true;
} Prevention
- Check complete: true in the resume JSON before scheduling retries.
- Delete the resume file when intentionally starting a fresh full fetch.
- In cron/wrapper scripts, treat this error as 'success: already done' rather than retrying.
When it happens
Trigger: Re-running `opencli twitter likes <user> --all --resume-file <path>` after the previous run finished successfully and wrote complete: true into the resume file.
Common situations: User re-runs the same command out of habit or to 'refresh' data; a wrapper script retries the command after the first run already completed; cron job re-invoked after successful completion.
Related errors
- Twitter likes resume file ${filePath} count does not match i
- --output-file requires --resume-file so partial archives rem
- 12306 whoami failed: ${probe.detail}
- Could not parse Twitter bookmarks resume file ${filePath}: $
- Twitter bookmarks resume file ${filePath} has an invalid sha
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/0ce73d39ee65914a.
Report an issue: GitHub.