jackwener/OpenCLI · error · ArgumentError

messageId "${v}" is not a full UUID. ${SHORT_ID_HINT}

Error message

messageId "${v}" is not a full UUID. ${SHORT_ID_HINT}

What it means

assertMessageIdShape enforces that messageId is a full UUID; any other non-empty string throws this ArgumentError including the offending value and a hint that 8-hex short ids from channel headers are NOT accepted. The message deliberately points to `bookmark-list` / `message-read` output as sources of full UUIDs.

Source

Thrown at clis/slock/resolve.js:43

    if (UUID_RE.test(rest)) return { kind: 'dm-uuid', userId: rest };
    if (rest.startsWith('@')) return { kind: 'dm-name', name: rest.slice(1) };
    throw new ArgumentError('dm target must be "dm:<userId-uuid>" or "dm:@name".');
  }
  const tt = classifyThreadTarget(v);
  if (tt) return { kind: 'thread', ...tt };
  if (UUID_RE.test(v)) return { kind: 'channel-uuid', channelId: v };
  return { kind: 'channel-name', name: v.replace(/^#/, '').toLowerCase() };
}

const SHORT_ID_HINT =
  'short ids (the 8-hex `msg=...` form in channel headers) are NOT accepted — use the FULL UUID ' +
  'from `bookmark-list` / `message-read` output.';

export function assertMessageIdShape(messageId) {
  const v = String(messageId ?? '').trim();
  if (!v) throw new ArgumentError('messageId required');
  if (!UUID_RE.test(v)) {
    throw new ArgumentError(`messageId "${v}" is not a full UUID. ${SHORT_ID_HINT}`);
  }
  return v;
}

export function parsePositiveInteger(value, name, { defaultValue, max } = {}) {
  const raw = value === undefined || value === null || value === '' ? defaultValue : value;
  const n = parseStrictInteger(raw);
  if (!Number.isInteger(n) || n <= 0 || (max !== undefined && n > max)) {
    const suffix = max !== undefined ? ` between 1 and ${max}` : ' as a positive integer';
    throw new ArgumentError(`${name} must be${suffix} (got "${raw}")`);
  }
  return n;
}

export function parseNonNegativeInteger(value, name, { defaultValue } = {}) {
  const raw = value === undefined || value === null || value === '' ? defaultValue : value;
  const n = parseStrictInteger(raw);
  if (!Number.isInteger(n) || n < 0) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Get the full UUID from `slock bookmark-list` or `slock message-read` output and use it for --messageId
  2. Validate against the UUID pattern before invoking: /^[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}$/
  3. Do not persist short ids in scripts — resolve to full UUIDs at capture time

Example fix

// before
$ slock reaction-add --messageId a1b2c3d4 --emoji 👍
// after
$ slock message-read --channel general --limit 1   # read full UUID from output
$ slock reaction-add --messageId a1b2c3d4-0000-1111-2222-333344445555 --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}$/;
const v = String(messageId ?? '').trim();
if (v && !UUID_RE.test(v)) throw new Error(`messageId "${v}" is not a full UUID; short ids are not accepted`);

Type guard

function isFullUuid(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.trim());
}

Try / catch

try {
  await cli('message-read', { messageId });
} catch (e) {
  if (e instanceof ArgumentError && e.message.includes('not a full UUID')) {
    console.error('Short ids from channel headers are rejected; re-resolve via bookmark-list or message-read.');
  } else throw e;
}

Prevention

When it happens

Trigger: Passing the 8-hex short id (`msg=a1b2c3d4` shown in channel headers) as --messageId; passing Slack-style timestamps, numeric row ids, or partial UUIDs — anything failing UUID_RE.

Common situations: Copying the short id from a channel header because it's what's visible; mixing up message short ids and UUIDs across Slock UI versions; storing short ids in scripts/bookmarks and later feeding them to reaction/read commands; truncating a UUID when copying from a narrow terminal.

Related errors


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