{"record":{"id":"2e393a4bd137c780","repo":"jackwener/OpenCLI","slug":"e-message-rethrown-from-assertmessageidshape","errorCode":null,"errorMessage":"${e.message} (rethrown from assertMessageIdShape; e.g. messageId \"${v}\" is not a full UUID)","messagePattern":"(.+?) \\(rethrown from assertMessageIdShape; e\\.g\\. messageId \"(.+?)\" is not a full UUID\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/reaction-add.js","lineNumber":27,"sourceCode":"cli({\n  site: SLOCK_SITE,\n  name: 'reaction-add',\n  access: 'write',\n  description: 'Add an emoji reaction to a message (POST /messages/:id/reactions). Idempotent server-side.',\n  domain: SLOCK_DOMAIN,\n  strategy: Strategy.COOKIE,\n  browser: true,\n  siteSession: 'persistent',\n  args: [\n    { name: 'messageId', positional: true, required: true, help: 'Full messageId UUID (short ids rejected)' },\n    { name: 'emoji', positional: true, required: true, help: 'A single unicode emoji, e.g. 👍' },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['messageId', 'emoji', 'result'],\n  func: async (page, kwargs) => {\n    let id;\n    try { id = assertMessageIdShape(String(kwargs.messageId ?? '')); }\n    catch (e) { throw new ArgumentError(e.message); }\n    const emoji = String(kwargs.emoji ?? '').trim();\n    if (!emoji) throw new ArgumentError('emoji required (a single unicode emoji)');\n    await page.goto(SLOCK_HOME_URL);\n    const snippet = buildFetchSnippet({\n      method: 'POST',\n      path: `/messages/${id}/reactions`,\n      body: { emoji },\n      serverScoped: true,\n      serverIdOverride: kwargs.server,\n    });\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    dispatchEvaluateResult(result);\n    return [{ messageId: id, emoji, result: 'added' }];\n  },\n});\n","sourceCodeStart":9,"sourceCodeEnd":43,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/reaction-add.js#L9-L43","documentation":"reaction-add validates the --messageId argument with assertMessageIdShape, which requires a full UUID. When that validator throws, the command rethrows the message wrapped as an ArgumentError with a 'rethrown from assertMessageIdShape' prefix, naming the offending value. This is a client-side input-shape check, not a server error.","triggerScenarios":"Calling `slock reaction-add` with a --messageId value that is empty, or not a full UUID (e.g. an 8-hex short id like `a1b2c3d4`, a numeric id, or a truncated string). The UUID_RE test `/^[0-9a-fA-F]{8}-...-12}$/` fails.","commonSituations":"Copy-pasting the short `msg=...` id shown in channel headers instead of the full UUID; trimming a UUID when copying; passing a Slack-style timestamp id (`1234567890.123456`); shell quoting issues truncating the value.","solutions":["Get the full UUID from `bookmark-list` or `message-read` output and pass it as --messageId","Verify the value matches a UUID pattern (8-4-4-4-12 hex) before invoking","Check for shell quoting/truncation of the argument"],"exampleFix":"// before\n$ slock reaction-add --messageId a1b2c3d4 --emoji 👍\n// after\n$ slock reaction-add --messageId 3f2c9e1a-7b4d-4c8a-9e2f-1a2b3c4d5e6f --emoji 👍","handlingStrategy":"validation","validationCode":"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}$/;\nif (!UUID_RE.test(String(messageId ?? ''))) throw new Error(`--messageId must be a full UUID, got: ${messageId}`);","typeGuard":"function isMessageId(v) {\n  return typeof v === 'string' &&\n    /^[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);\n}","tryCatchPattern":"try {\n  await cli('reaction-add', { messageId, emoji });\n} catch (e) {\n  if (e instanceof ArgumentError && e.message.includes('not a full UUID')) {\n    console.error(`Bad messageId \"${messageId}\"; fetch the full UUID via message-read or bookmark-list.`);\n  } else throw e;\n}","preventionTips":["Store full UUIDs, never 8-hex short ids, in scripts and bookmarks","Copy ids from message-read/bookmark-list output, not channel headers","Validate id format at the boundary where the id enters your script","Watch for shell truncation when passing long UUIDs"],"tags":["argument-validation","uuid","input-validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}