jackwener/OpenCLI · error · ArgumentError

Video file not found: ${resolved}

Error message

Video file not found: ${resolved}

What it means

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.

Source

Thrown at clis/instagram/reel.js:23

import { cli, Strategy } from '@jackwener/opencli/registry';
import { ArgumentError, AuthRequiredError, CommandExecutionError } from '@jackwener/opencli/errors';
import { buildClickActionJs, buildEnsureComposerOpenJs, buildInspectUploadStageJs, } from './post.js';
import { resolveCurrentUserId, resolveInstagramRuntimeInfo } from './_shared/runtime-info.js';
import { INSTAGRAM_HOME_URL, gotoInstagramHome } from './_shared/navigation.js';
const SUPPORTED_VIDEO_EXTENSIONS = new Set(['.mp4']);
const INSTAGRAM_REEL_TIMEOUT_SECONDS = 600;
function requirePage(page) {
    if (!page)
        throw new CommandExecutionError('Browser session required for instagram reel');
    return page;
}
function validateVideoPath(input) {
    const resolved = path.resolve(String(input || '').trim());
    if (!resolved) {
        throw new ArgumentError('Video path cannot be empty');
    }
    if (!fs.existsSync(resolved)) {
        throw new ArgumentError(`Video file not found: ${resolved}`);
    }
    const ext = path.extname(resolved).toLowerCase();
    if (!SUPPORTED_VIDEO_EXTENSIONS.has(ext)) {
        throw new ArgumentError(`Unsupported video format: ${ext}`, 'Supported formats: .mp4');
    }
    return resolved;
}
function validateInstagramReelArgs(kwargs) {
    if (kwargs.video === undefined) {
        throw new ArgumentError('Argument "video" is required.', 'Provide --video /path/to/file.mp4');
    }
}
function buildInstagramReelSuccessResult(url) {
    return [{
            status: '✅ Posted',
            detail: 'Single reel shared successfully',
            url,
        }];

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the file exists at the printed resolved path (ls the path).
  2. Use an absolute path in --video to avoid cwd surprises.
  3. Ensure the file is generated/mounted before running the command in CI/containers.
  4. Check file permissions allow the process to stat the path.

Example fix

// before
await reel({ video: 'clip.mp4' }); // relative, cwd-dependent
// after
const p = path.resolve(__dirname, 'assets/clip.mp4');
if (!fs.existsSync(p)) throw new Error(`Missing video: ${p}`);
await reel({ video: p });
Defensive patterns

Strategy: validation

Validate before calling

const p = path.resolve(args.video);
if (!fs.existsSync(p)) throw new Error(`Video file missing: ${p}`);

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: CI checkout layout differs from local, file produced by a prior step that failed, container without the file mounted, or Windows/POSIX path mixups.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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