jackwener/OpenCLI · error · ArgumentError

${e.message} (rethrown from assertMessageIdShape; e.g. messa

Error message

${e.message} (rethrown from assertMessageIdShape; e.g. messageId "${v}" is not a full UUID)

What it means

reaction-remove validates --messageId with assertMessageIdShape exactly like reaction-add; a non-UUID or empty value is rethrown as an ArgumentError with the 'rethrown from assertMessageIdShape' prefix. Full UUIDs are required because the in-page fetch DELETEs `/messages/<uuid>/reactions`.

Source

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

cli({
  site: SLOCK_SITE,
  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. Fetch the full message UUID via `bookmark-list` or `message-read` and use it for --messageId
  2. Validate the value against the UUID 8-4-4-4-12 hex pattern before running
  3. Re-copy the id carefully, ensuring no truncation

Example fix

// before
$ slock reaction-remove --messageId 9f8e7d6c --emoji 👍
// after
$ slock reaction-remove --messageId 9f8e7d6c-1111-2222-3333-abcdef012345 --emoji 👍
Defensive patterns

Strategy: validation

Validate before calling

const UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
if (!UUID_RE.test(String(messageId ?? ''))) throw new Error(`--messageId must be a full UUID, got: ${messageId}`);

Type guard

function isMessageId(v) {
  return typeof v === 'string' &&
    /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(v);
}

Try / catch

try {
  await cli('reaction-remove', { messageId, emoji });
} catch (e) {
  if (e instanceof ArgumentError && e.message.includes('not a full UUID')) {
    console.error(`"${messageId}" is not a full UUID; use message-read/bookmark-list output instead of header short ids.`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling `slock reaction-remove` with --messageId that is empty or fails UUID_RE — most commonly the 8-hex short id from channel headers, a Slack-style timestamp, or a truncated/partially pasted UUID.

Common situations: Reusing a short id copied from a channel header banner; copying only part of a long UUID; passing a message index or number instead of an id; stale notes containing ids from an older Slock format.

Related errors


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