{"record":{"id":"bcad27bdc4d159bc","repo":"jackwener/OpenCLI","slug":"twitter-likes-output-file-is-missing-for-resume-st","errorCode":null,"errorMessage":"Twitter likes output file is missing for resume state: ${outputFile}","messagePattern":"Twitter likes output file is missing for resume state: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/twitter/likes.js","lineNumber":277,"sourceCode":"        // Get userId from screen_name\n        const userId = unwrapBrowserResult(await page.evaluate(`async () => {\n      const screenName = ${JSON.stringify(username)};\n      const url = ${JSON.stringify(buildUserByScreenNameQueryUrl(userByScreenNameQueryId, username))};\n      const resp = await fetch(url, { headers: ${headers}, credentials: 'include' });\n      if (!resp.ok) return null;\n      const d = await resp.json();\n      return d.data?.user?.result?.rest_id || null;\n    }`));\n        if (!userId) {\n            throw new CommandExecutionError(`Could not find user @${username}`);\n        }\n        const resumed = fetchAll ? readResumeFile(resumeFile, {\n            source: 'likes',\n            username,\n            outputFile: useOutputFile ? outputFile : null,\n        }) : null;\n        if (useOutputFile && resumed && resumed.count > 0 && !fs.existsSync(outputFile)) {\n            throw new CommandExecutionError(`Twitter likes output file is missing for resume state: ${outputFile}`);\n        }\n        if (useOutputFile && !resumed && fs.existsSync(outputFile)) {\n            throw new ArgumentError(`Refusing to overwrite existing Twitter likes output file: ${outputFile}`);\n        }\n        const allTweets = useOutputFile ? [] : (resumed?.tweets ? [...resumed.tweets] : []);\n        const jsonlState = useOutputFile ? loadJsonlArchiveState(outputFile) : null;\n        const seen = useOutputFile\n            ? jsonlState.seen\n            : new Set(allTweets.map((tweet) => tweet?.id).filter(Boolean));\n        if (useOutputFile && resumed && jsonlState.count !== resumed.count) {\n            throw new CommandExecutionError(`Twitter likes output file has ${jsonlState.count} record(s), expected resume count ${resumed.count}`);\n        }\n        let outputCount = useOutputFile ? jsonlState.count : 0;\n        let cursor = resumed?.cursor || null;\n        let lastRawResponse = null;\n        let pages = 0;\n        let exhausted = false;\n        // Runaway guard only; --limit/--all and cursor exhaustion control normal pagination.","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/likes.js#L259-L295","documentation":"CommandExecutionError thrown during --resume validation: the resume state file records a positive count of previously fetched likes, but the JSONL output file it references no longer exists on disk. The library refuses to resume because it cannot rebuild a consistent archive state from a missing file.","triggerScenarios":"fetchAll is set, readResumeFile returns resumed.count > 0 and useOutputFile is true, but fs.existsSync(outputFile) is false at clis/twitter/likes.js:277.","commonSituations":"The user deleted or moved the output JSONL between runs while keeping the hidden resume file; output written to a different --output path than the original run; running from a different working directory with a relative output path.","solutions":["Delete the stale resume file (e.g. the .resume/.state sidecar next to the output) and re-run from scratch.","Re-run with the exact same --output path used in the original run so the existing JSONL is found.","Restore the deleted/moved output file, then resume again.","Run from the same working directory if the output path was relative."],"exampleFix":"// before\n$ cli twitter likes @user --all --resume  # output file was deleted\n// after\n$ rm .twitter-likes-user.resume\n$ cli twitter likes @user --all --output likes.jsonl","handlingStrategy":"validation","validationCode":"const fs = require('node:fs');\nif (resumeExists() && !fs.existsSync(outputFile)) {\n  fs.rmSync(resumeFile); // clear stale resume state before re-running\n}","typeGuard":"null","tryCatchPattern":"try {\n  await cli.twitter.likes({ username, all: true, resume: true });\n} catch (e) {\n  if (/output file is missing for resume state/.test(e.message)) {\n    deleteResumeFile(); // then re-run fresh\n  } else throw e;\n}","preventionTips":["Always pass the same --output path used in the original run","Delete resume state when you delete the output archive","Run from a stable working directory with absolute output paths","Back up both the JSONL and its resume sidecar together"],"tags":["resume","filesystem","state"],"backgroundTag":"resume-state-mismatch","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}