jackwener/OpenCLI · error · ArgumentError

Video path cannot be empty

Error message

Video path cannot be empty

What it means

validateVideoPath resolves the user-supplied video argument; if the trimmed string produces an empty path it throws ArgumentError. The library requires an explicit video file to upload as a reel. It guards against empty, whitespace-only, or missing --video input.

Source

Thrown at clis/instagram/reel.js:20

import * as os from 'node:os';
import * as path from 'node:path';
import { Page as BrowserPage } from '@jackwener/opencli/browser/page';
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',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass a valid path: instagram reel --video /path/to/file.mp4.
  2. Check the variable feeding --video is set and non-empty in your script/CI.
  3. Quote the path so shell parsing doesn't swallow it.

Example fix

// before
const video = process.env.VIDEO || '';
await reel({ video });
// after
const video = process.env.VIDEO;
if (!video) throw new Error('VIDEO env var must point to an .mp4 file');
await reel({ video });
Defensive patterns

Strategy: validation

Validate before calling

const video = (args.video || '').trim();
if (!video) throw new Error('--video is required: provide /path/to/file.mp4');

Type guard

function hasVideoArg(kwargs) { return kwargs != null && typeof kwargs.video === 'string' && kwargs.video.trim().length > 0; }

Try / catch

try { await reel(args); } catch (e) { if (e.message === 'Video path cannot be empty') { console.error('Usage: --video /path/to/file.mp4'); process.exitCode = 2; return; } throw e; }

Prevention

When it happens

Trigger: Invoking the reel command with no --video flag, an empty string, or a value consisting only of whitespace.

Common situations: Script/CI invocation where the video variable is unset or empty, quoting mistakes that drop the argument, or forgetting the flag entirely.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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