{"record":{"id":"0850a09e0606a0f0","repo":"jackwener/OpenCLI","slug":"resume-file-requires-all-0850a0","errorCode":null,"errorMessage":"--resume-file requires --all","messagePattern":"--resume-file requires --all","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/twitter/likes.js","lineNumber":218,"sourceCode":"        { name: 'top-by-engagement', type: 'int', default: 0, help: 'When set to N>0, re-rank the liked tweets by weighted engagement (likes×1 + retweets×3 + replies×2 + bookmarks×5 + log10(views+1)×0.5) and return the top N. Default 0 keeps the API\\'s native (recency) ordering. Incompatible with --output-file.' },\n    ],\n    columns: ['id', 'author', 'name', 'text', 'likes', 'retweets', 'created_at', 'url', 'has_media', 'media_urls', 'media_posters'],\n    func: async (page, kwargs) => {\n        const fetchAll = Boolean(kwargs.all);\n        const limit = fetchAll ? Number.POSITIVE_INFINITY : (kwargs.limit || 20);\n        const resumeFile = resolveOptionalFilePath(kwargs['resume-file'], '--resume-file');\n        const outputFile = resolveOptionalFilePath(kwargs['output-file'], '--output-file');\n        const useOutputFile = Boolean(fetchAll && outputFile);\n        const maxPages = resolveMaxPages(kwargs, fetchAll);\n        const topByEngagement = Number(kwargs['top-by-engagement'] || 0);\n        if (useOutputFile && topByEngagement > 0) {\n            throw new ArgumentError('--top-by-engagement cannot be combined with --output-file');\n        }\n        if (outputFile && !fetchAll) {\n            throw new ArgumentError('--output-file requires --all');\n        }\n        if (resumeFile && !fetchAll) {\n            throw new ArgumentError('--resume-file requires --all');\n        }\n        if (outputFile && !resumeFile) {\n            throw new ArgumentError('--output-file requires --resume-file so partial archives remain resumable');\n        }\n        const rawUsername = String(kwargs.username ?? '').trim();\n        let username = normalizeTwitterScreenName(rawUsername);\n        if (rawUsername && !username) {\n            throw new ArgumentError('twitter likes username must be a valid Twitter/X handle', 'Example: opencli twitter likes @jack --limit 20');\n        }\n        const cookies = await page.getCookies({ url: 'https://x.com' });\n        const ct0 = cookies.find((c) => c.name === 'ct0')?.value || null;\n        if (!ct0)\n            throw new AuthRequiredError('x.com', 'Not logged into x.com (no ct0 cookie)');\n        // If no username provided, detect the logged-in user.\n        // Bridge wraps primitive page.evaluate returns as { session, data:<value> };\n        // unwrap so the href string is usable downstream.\n        if (!username) {\n            // Force a navigation to the home surface so the AppTabBar sidebar","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/likes.js#L200-L236","documentation":"Same family as the previous check: --resume-file (the resumable state store) is only wired up for full-archive (--all) runs. Without --all the resume machinery is not engaged, so ArgumentError is thrown during argument validation.","triggerScenarios":"Running `opencli twitter likes @jack --resume-file likes.json` (or with --limit) without --all.","commonSituations":"User wants checkpointing for a long limited pull and adds --resume-file, not realizing it applies only to --all; automation templates carrying --resume-file into short test invocations.","solutions":["Add --all to the command so resume state is actually used.","Remove --resume-file if you are doing a small paginated fetch that doesn't need resuming."],"exampleFix":"// before\nopencli twitter likes @jack --limit 500 --resume-file likes.json\n// after\nopencli twitter likes @jack --all --resume-file likes.json --output-file likes.ndjson","handlingStrategy":"validation","validationCode":"if (args.includes('--resume-file') && !args.includes('--all')) {\n  throw new Error('--resume-file requires --all');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only add --resume-file when the run is a --all full fetch.","For short limited pulls, rely on --limit and skip resume state entirely."],"tags":["cli","argument-validation","twitter","missing-flag"],"backgroundTag":"missing-required-flag","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}