jackwener/OpenCLI · error · CommandExecutionError
Instagram private publish only supports single-video uploads
Error message
Instagram private publish only supports single-video uploads through instagram reel
What it means
publishMediaViaPrivateApi supports two paths: a single image goes through /media/configure/, and multiple items go through configure_sidecar. If exactly one item is uploaded but it is not an image (i.e. a single video), there is no supported configure path in the private publish flow (videos are published via the instagram reel command), so the library throws this guard error.
Source
Thrown at clis/instagram/_shared/private-publish.js:893
}
export async function publishMediaViaPrivateApi(input) {
const now = input.now ?? (() => Date.now());
const clientSidecarId = String(now());
const uploadIds = input.mediaItems.length > 1
? input.mediaItems.map((_, index) => String(now() + index + 1))
: [String(now())];
const fetcher = input.fetcher ?? ((url, init) => instagramPrivateApiFetch(input.page, url, init));
const prepareMediaAsset = input.prepareMediaAsset ?? prepareInstagramMediaAsset;
const assets = await Promise.all(input.mediaItems.map((item) => prepareMediaAsset(item)));
try {
for (let index = 0; index < assets.length; index += 1) {
const asset = assets[index];
const uploadId = uploadIds[index];
await uploadPreparedMediaAsset(fetcher, asset, uploadId, input.apiContext);
}
if (uploadIds.length === 1) {
if (assets[0]?.type !== 'image') {
throw new CommandExecutionError('Instagram private publish only supports single-video uploads through instagram reel');
}
const response = await fetcher('https://www.instagram.com/api/v1/media/configure/', {
method: 'POST',
headers: {
...buildPrivateApiHeaders(input.apiContext),
'Content-Type': 'application/x-www-form-urlencoded',
},
body: buildConfigureBody({
uploadId: uploadIds[0],
caption: input.caption,
jazoest: input.jazoest,
}),
});
const json = await parseJsonResponse(response, 'configure');
return { code: json?.media?.code, uploadIds };
}
const result = await publishSidecarWithRetry({
fetcher,View on GitHub (pinned to 49907e53dc)
Solutions
- Use the instagram reel publish command for single-video posts instead of the private media publish path.
- Add a pre-check before calling: if mediaItems.length === 1 and type !== 'image', route to the reel flow.
- Group the single video with at least one other item to use the sidecar path (if a carousel is acceptable).
- Convert the video to a still image (thumbnail) if an image post is acceptable.
Example fix
// before
await publishMediaViaPrivateApi({ mediaItems: [{ type: 'video', filePath: 'clip.mp4' }], apiContext });
// after
if (mediaItems.length === 1 && mediaItems[0].type === 'video') {
await publishReel({ filePath: 'clip.mp4', apiContext }); // reel path
} else {
await publishMediaViaPrivateApi({ mediaItems, apiContext });
} Defensive patterns
Strategy: validation
Validate before calling
function assertPublishableMediaItems(mediaItems) {
if (mediaItems.length === 1 && mediaItems[0].type !== 'image') {
throw new Error('Single video: use the instagram reel publish path instead');
}
}
assertPublishableMediaItems(mediaItems); Type guard
function isSingleImage(items) {
return items.length === 1 && items[0].type === 'image';
} Prevention
- Route single-video posts to the reel publish flow before calling this API.
- Validate media item types/count before invoking publishMediaViaPrivateApi.
- For mixed carousels, confirm the sidecar path supports your combination.
- Add a unit test covering each media-shape → publish-path mapping.
When it happens
Trigger: Calling publishMediaViaPrivateApi (or publishImagesViaPrivateApi with a video path) with mediaItems containing exactly one item whose prepared asset type is not 'image' — a single video upload.
Common situations: Passing a video file to publishImagesViaPrivateApi by mistake; dynamically selected media that happens to be one video; expecting parity with the multi-video sidecar path.
Related errors
- Instagram private publish configure_sidecar timed out waitin
- ${label}
- Collection name cannot be empty
- index must be a positive integer
- ${label} returned malformed items payload
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/6f5be1e40e551bfa.
Report an issue: GitHub.