{"record":{"id":"b98116ee3d0622b7","repo":"jackwener/OpenCLI","slug":"attach-expects-attachmentid-uuids-aid-is-n","errorCode":null,"errorMessage":"--attach expects attachmentId UUIDs; \"${aid}\" is not a UUID","messagePattern":"--attach expects attachmentId UUIDs; \"(.+?)\" is not a UUID","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/message-send.js","lineNumber":35,"sourceCode":"  siteSession: 'persistent',\n  args: [\n    { name: 'target', positional: true, required: true, help: '\"#channel\", \"#channel:msgIdOrShort\", \"dm:@name\", \"dm:<uuid>\", or channel UUID' },\n    { name: 'content', positional: true, required: true, help: 'Message body (sent verbatim, no marker)' },\n    { name: 'dry-run', type: 'bool', default: false, help: 'Print the planned payload without sending' },\n    { name: 'as-task', type: 'bool', default: false, help: 'Create the message as a task (asTask)' },\n    { name: 'attach', help: 'Comma-separated attachmentId UUIDs (upload separately first)' },\n    { name: 'server', help: 'Override active server (slug or id)' },\n  ],\n  columns: ['target', 'channelId', 'content', 'result', 'messageId'],\n  func: async (page, kwargs) => {\n    const target = String(kwargs.target ?? '').trim();\n    if (!target) throw new ArgumentError('target required');\n    const content = String(kwargs.content ?? '');\n    const asTask = !!kwargs['as-task'];\n    const attachmentIds = String(kwargs.attach ?? '')\n      .split(',').map((s) => s.trim()).filter(Boolean);\n    for (const aid of attachmentIds) {\n      if (!UUID_RE.test(aid)) throw new ArgumentError(`--attach expects attachmentId UUIDs; \"${aid}\" is not a UUID`);\n    }\n    let cls;\n    try { cls = classifyTarget(target); }\n    catch (e) { throw new ArgumentError(e.message); }\n\n    const extra = { asTask, attachmentIds };\n\n    if (kwargs['dry-run']) {\n      return [{\n        target, channelId: '(not resolved in dry-run)', content,\n        result: asTask ? 'dry-run (asTask)' : 'dry-run', messageId: null,\n      }];\n    }\n\n    await page.goto(SLOCK_HOME_URL);\n    const snippet = buildSendSnippet(target, content, cls, kwargs.server, extra);\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    const rows = dispatchEvaluateResult(result);","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/message-send.js#L17-L53","documentation":"message-send.js parses `--attach` as a comma-separated list of attachmentId UUIDs and validates each against UUID_RE. Any entry that isn't a valid UUID throws this ArgumentError naming the bad entry.","triggerScenarios":"Passing `--attach` values that are file paths, filenames, short ids, upload-returned names instead of UUIDs, or a list with stray whitespace-adjacent garbage tokens.","commonSituations":"Passing local file paths to --attach instead of uploading first and using returned attachmentIds; copying a truncated UUID; comma+space splitting leaving empty or malformed tokens.","solutions":["Upload the file first (upload command) and use the returned attachmentId UUID.","Fix typos/truncation in the UUID (must match the standard UUID format).","Comma-separate multiple ids without extra tokens: `--attach <uuid1>,<uuid2>`."],"exampleFix":"// before\n--attach ./report.pdf\n// after\n--attach 9b2f0a1c-3d4e-4f5a-8b9c-0d1e2f3a4b5c","handlingStrategy":"validation","validationCode":"const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nfor (const aid of String(kwargs.attach ?? '').split(',').map(s => s.trim()).filter(Boolean)) {\n  if (!UUID_RE.test(aid)) throw new Error(`--attach needs attachmentId UUIDs; \"${aid}\" is not a UUID`);\n}","typeGuard":"const isUuid = (v) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(String(v));","tryCatchPattern":"try { await sendMessage(page, kwargs); } catch (e) { if (String(e.message).includes('--attach expects attachmentId UUIDs')) { console.error('Upload files first and pass returned attachmentId UUIDs'); } else throw e; }","preventionTips":["Always upload files first; use the returned attachmentId, not the file path","Validate UUID format in scripts before invoking message-send","Split comma lists and trim tokens before passing --attach"],"tags":["invalid-argument","uuid","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}