jackwener/OpenCLI Β· error Β· ArgumentError

emoji required (the unicode emoji to remove)

Error message

emoji required (the unicode emoji to remove)

What it means

reaction-remove requires a non-empty --emoji identifying which reaction to delete; an empty or whitespace-only value raises this ArgumentError. Without the emoji the DELETE /messages/<id>/reactions body would be meaningless.

Source

Thrown at clis/slock/reaction-remove.js:29

  name: 'reaction-remove',
  access: 'write',
  description: 'Remove your emoji reaction from a message (DELETE /messages/:id/reactions).',
  domain: SLOCK_DOMAIN,
  strategy: Strategy.COOKIE,
  browser: true,
  siteSession: 'persistent',
  args: [
    { name: 'messageId', positional: true, required: true, help: 'Full messageId UUID (short ids rejected)' },
    { name: 'emoji', positional: true, required: true, help: 'The unicode emoji to remove, e.g. πŸ‘' },
    { name: 'server', help: 'Override active server' },
  ],
  columns: ['messageId', 'emoji', 'result'],
  func: async (page, kwargs) => {
    let id;
    try { id = assertMessageIdShape(String(kwargs.messageId ?? '')); }
    catch (e) { throw new ArgumentError(e.message); }
    const emoji = String(kwargs.emoji ?? '').trim();
    if (!emoji) throw new ArgumentError('emoji required (the unicode emoji to remove)');
    await page.goto(SLOCK_HOME_URL);
    const snippet = buildFetchSnippet({
      method: 'DELETE',
      path: `/messages/${id}/reactions`,
      body: { emoji },
      serverScoped: true,
      serverIdOverride: kwargs.server,
    });
    const result = await page.evaluate(`(async () => { ${snippet} })()`);
    dispatchEvaluateResult(result);
    return [{ messageId: id, emoji, result: 'removed' }];
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass the exact unicode emoji of the reaction to remove: `--emoji "πŸ‘"`
  2. Check the flag spelling β€” a misspelled flag falls back to empty via `kwargs.emoji ?? ''`
  3. Ensure UTF-8 encoding in the shell/script so the emoji reaches argv

Example fix

// before
$ slock reaction-remove --messageId <uuid> --emoj "πŸ‘"   # typo, emoji empty
// after
$ slock reaction-remove --messageId <uuid> --emoji "πŸ‘"
Defensive patterns

Strategy: validation

Validate before calling

const emoji = String(kwargs.emoji ?? '').trim();
if (!emoji) throw new Error('--emoji required: pass the unicode emoji of the reaction to remove');

Type guard

function isEmoji(v) {
  return typeof v === 'string' && v.trim().length > 0 &&
    /\p{Extended_Pictographic}/u.test(v.trim());
}

Try / catch

try {
  await cli('reaction-remove', { messageId, emoji });
} catch (e) {
  if (e instanceof ArgumentError && e.message.includes('emoji required')) {
    console.error('--emoji was empty; verify the variable holding the emoji and quote it in the shell.');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `slock reaction-remove` without --emoji, with `--emoji ""`, `--emoji=`, or a whitespace-only value.

Common situations: Script variable holding the emoji was unset/empty; encoding issue dropped the emoji from argv; typo where the flag name was wrong so kwargs.emoji defaulted to '' via the `?? ''` fallback.

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/422670750e77489b. Report an issue: GitHub.