{"record":{"id":"a86325e3cb53c1c2","repo":"jackwener/OpenCLI","slug":"video-file-not-found-resolved","errorCode":null,"errorMessage":"Video file not found: ${resolved}","messagePattern":"Video file not found: (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/instagram/reel.js","lineNumber":23,"sourceCode":"import { cli, Strategy } from '@jackwener/opencli/registry';\nimport { ArgumentError, AuthRequiredError, CommandExecutionError } from '@jackwener/opencli/errors';\nimport { buildClickActionJs, buildEnsureComposerOpenJs, buildInspectUploadStageJs, } from './post.js';\nimport { resolveCurrentUserId, resolveInstagramRuntimeInfo } from './_shared/runtime-info.js';\nimport { INSTAGRAM_HOME_URL, gotoInstagramHome } from './_shared/navigation.js';\nconst SUPPORTED_VIDEO_EXTENSIONS = new Set(['.mp4']);\nconst INSTAGRAM_REEL_TIMEOUT_SECONDS = 600;\nfunction requirePage(page) {\n    if (!page)\n        throw new CommandExecutionError('Browser session required for instagram reel');\n    return page;\n}\nfunction validateVideoPath(input) {\n    const resolved = path.resolve(String(input || '').trim());\n    if (!resolved) {\n        throw new ArgumentError('Video path cannot be empty');\n    }\n    if (!fs.existsSync(resolved)) {\n        throw new ArgumentError(`Video file not found: ${resolved}`);\n    }\n    const ext = path.extname(resolved).toLowerCase();\n    if (!SUPPORTED_VIDEO_EXTENSIONS.has(ext)) {\n        throw new ArgumentError(`Unsupported video format: ${ext}`, 'Supported formats: .mp4');\n    }\n    return resolved;\n}\nfunction validateInstagramReelArgs(kwargs) {\n    if (kwargs.video === undefined) {\n        throw new ArgumentError('Argument \"video\" is required.', 'Provide --video /path/to/file.mp4');\n    }\n}\nfunction buildInstagramReelSuccessResult(url) {\n    return [{\n            status: '✅ Posted',\n            detail: 'Single reel shared successfully',\n            url,\n        }];","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/reel.js#L5-L41","documentation":"After resolving the video path, validateVideoPath checks fs.existsSync; if the file does not exist on disk it throws ArgumentError including the resolved absolute path. The CLI must read the file to upload it, so a missing file is rejected before any browser interaction.","triggerScenarios":"Passing --video with a path that does not exist — typo in filename, wrong working directory, deleted/moved file, or a relative path resolved against an unexpected cwd.","commonSituations":"CI checkout layout differs from local, file produced by a prior step that failed, container without the file mounted, or Windows/POSIX path mixups.","solutions":["Verify the file exists at the printed resolved path (ls the path).","Use an absolute path in --video to avoid cwd surprises.","Ensure the file is generated/mounted before running the command in CI/containers.","Check file permissions allow the process to stat the path."],"exampleFix":"// before\nawait reel({ video: 'clip.mp4' }); // relative, cwd-dependent\n// after\nconst p = path.resolve(__dirname, 'assets/clip.mp4');\nif (!fs.existsSync(p)) throw new Error(`Missing video: ${p}`);\nawait reel({ video: p });","handlingStrategy":"validation","validationCode":"const p = path.resolve(args.video);\nif (!fs.existsSync(p)) throw new Error(`Video file missing: ${p}`);","typeGuard":null,"tryCatchPattern":"try { await reel(args); } catch (e) { if (e.message.startsWith('Video file not found')) { console.error('Check the resolved path printed in the error; use an absolute path.'); return; } throw e; }","preventionTips":["Use absolute paths for --video","Assert file existence in CI before the upload step","Ensure prior steps that generate the video succeeded","Mount/copy the file into containers before running"],"tags":["file-not-found","argument-validation","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}