jackwener/OpenCLI · error · ArgumentError
Instagram note content must be 60 characters or fewer.
Error message
Instagram note content must be 60 characters or fewer.
What it means
Instagram notes are limited to 60 characters; normalizeInstagramNoteContent counts characters with Array.from(content).length (code points, so emoji count once) and throws this ArgumentError when the trimmed content exceeds 60. This prevents sending a mutation Instagram would reject.
Source
Thrown at clis/instagram/note.js:23
const INSTAGRAM_NOTE_MUTATION_NAME = 'usePolarisCreateInboxTrayItemSubmitMutation';
const INSTAGRAM_NOTE_ROOT_FIELD = 'xdt_create_inbox_tray_item';
function requirePage(page) {
if (!page)
throw new CommandExecutionError('Browser session required for instagram note');
return page;
}
function validateInstagramNoteArgs(kwargs) {
if (kwargs.content === undefined) {
throw new ArgumentError('Argument "content" is required.', 'Provide a note text, for example: opencli instagram note "hello"');
}
}
function normalizeInstagramNoteContent(kwargs) {
const content = String(kwargs.content ?? '').trim();
if (!content) {
throw new ArgumentError('Instagram note content cannot be empty.', 'Provide a non-empty note text, for example: opencli instagram note "hello"');
}
if (Array.from(content).length > 60) {
throw new ArgumentError('Instagram note content must be 60 characters or fewer.', 'Shorten the note text and try again.');
}
return content;
}
function buildNoteSuccessResult(noteId) {
return [{
status: '✅ Posted',
detail: 'Instagram note published successfully',
noteId,
}];
}
function buildPublishInstagramNoteJs(content) {
return `
(async () => {
const input = ${JSON.stringify({ content })};
const html = document.documentElement?.outerHTML || '';
const scripts = Array.from(document.scripts || [])
.map((script) => script.textContent || '')
.join('\\n');View on GitHub (pinned to 49907e53dc)
Solutions
- Shorten the note to 60 code points or fewer
- Pre-truncate in scripts: Array.from(text).slice(0, 60).join('')
- Validate length before calling to get a friendlier failure
- Avoid heavy emoji usage if measuring with .length (UTF-16) — use Array.from or the Intl.Segmenter for accurate counting
Example fix
// before
await instagramNote(ctx, { content: longStatus }); // may exceed 60
// after
const note = Array.from(longStatus.trim()).slice(0, 60).join('');
await instagramNote(ctx, { content: note }); Defensive patterns
Strategy: validation
Validate before calling
if (Array.from(noteText.trim()).length > 60) {
noteText = Array.from(noteText.trim()).slice(0, 60).join('');
} Type guard
function isWithinNoteLimit(text, max = 60) {
return typeof text === 'string' && Array.from(text.trim()).length <= max;
} Try / catch
try {
await instagramNote(ctx, { content: noteText });
} catch (e) {
if (e.message.includes('60 characters')) {
console.error('Note exceeds 60 code points; shorten or truncate before retrying.');
} else throw e;
} Prevention
- Measure length with Array.from (code points), not .length (UTF-16)
- Truncate generated/dynamic note text to 60 code points
- Add a length assertion in scripts that compose note text
- Limit emoji-heavy content, which is easy to miscount
When it happens
Trigger: Content whose Unicode code-point length is 61+ — e.g. a long sentence, or repeated emoji where the developer counted UTF-16 units instead of code points and misestimated length.
Common situations: Pasting a tweet-length message; assuming the limit is in bytes or UTF-16 units; scripts generating dynamic note text (timestamps, status) that can exceed 60.
Related errors
- Post index ${(idx + 1)} not found
- Video path cannot be empty
- Unsupported video format: ${ext}
- minimax music ${flag} must be at most ${max} characters
- Title must be at most ${MAX_TITLE_LEN} characters (got ${tit
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/07f94ddab3a842e6.
Report an issue: GitHub.