{"record":{"id":"6b4cb7becd6436b9","repo":"jackwener/OpenCLI","slug":"emoji-required-a-single-unicode-emoji","errorCode":null,"errorMessage":"emoji required (a single unicode emoji)","messagePattern":"emoji required \\(a single unicode emoji\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/reaction-add.js","lineNumber":29,"sourceCode":"  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":11,"sourceCodeEnd":43,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/reaction-add.js#L11-L43","documentation":"reaction-add requires a non-empty --emoji argument and throws ArgumentError when it is missing or whitespace-only after trimming. Emoji is used as the reaction key in the POST body, so the command refuses to run without one.","triggerScenarios":"Invoking `slock reaction-add` without --emoji, with `--emoji \"\"`, or with a value consisting only of whitespace. The check `String(kwargs.emoji ?? '').trim()` yields an empty string.","commonSituations":"Forgetting the flag in scripts; shell stripping the emoji (e.g. locale/encoding problems making the argument empty); accidentally passing `--emoji=` with no value; using a plain-text word like `thumbsup` that survives but only matters if it was actually empty — the error only fires on truly empty input.","solutions":["Pass a single unicode emoji, e.g. `--emoji 👍`","Quote the emoji in the shell: `--emoji \"👍\"`","Check terminal/locale (UTF-8) if the emoji appears to vanish from the argv"],"exampleFix":"// before\n$ slock reaction-add --messageId <uuid> --emoji=\n// after\n$ slock reaction-add --messageId <uuid> --emoji \"👍\"","handlingStrategy":"validation","validationCode":"const emoji = String(kwargs.emoji ?? '').trim();\nif (!emoji) throw new Error('--emoji required: pass a single unicode emoji, e.g. --emoji \"👍\"');","typeGuard":"function isEmoji(v) {\n  return typeof v === 'string' && v.trim().length > 0 &&\n    /\\p{Extended_Pictographic}/u.test(v.trim());\n}","tryCatchPattern":"try {\n  await cli('reaction-add', { messageId, emoji });\n} catch (e) {\n  if (e instanceof ArgumentError && e.message.includes('emoji required')) {\n    console.error('Missing --emoji; pass a single unicode emoji quoted for your shell.');\n  } else throw e;\n}","preventionTips":["Always quote emoji arguments in the shell","Ensure UTF-8 locale so emoji survive argv encoding","Check flag spelling (--emoji, not --emoj/--emote)","Default the emoji in wrapper scripts with an explicit error if unset"],"tags":["argument-validation","missing-argument","input-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}