{"record":{"id":"1c387b8c3f7fc3ee","repo":"jackwener/OpenCLI","slug":"e-message-rethrown-from-assertmessageidshape-1c387b","errorCode":null,"errorMessage":"${e.message} (rethrown from assertMessageIdShape; e.g. taskId is not a full UUID)","messagePattern":"(.+?) \\(rethrown from assertMessageIdShape; e\\.g\\. taskId is not a full UUID\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/task-claim.js","lineNumber":35,"sourceCode":"\ncli({\n  site: SLOCK_SITE,\n  name: 'task-claim',\n  access: 'write',\n  description: 'Claim a chat task (PATCH /tasks/:id/claim). Requires full task UUID (= message id).',\n  domain: SLOCK_DOMAIN,\n  strategy: Strategy.COOKIE,\n  browser: true,\n  siteSession: 'persistent',\n  args: [\n    { name: 'taskId', positional: true, required: true, help: 'Full task UUID (= message id; short ids rejected)' },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['taskId', 'taskStatus', 'assigneeId', 'taskNumber'],\n  func: async (page, kwargs) => {\n    let id;\n    try { id = assertMessageIdShape(String(kwargs.taskId ?? '')); }\n    catch (e) { throw new ArgumentError(e.message); }\n    await page.goto(SLOCK_HOME_URL);\n    const snippet = `\n      ${authHeadersFragment({ serverScoped: true, serverIdOverride: kwargs.server })}\n      const res = await fetch('${SLOCK_API_BASE}/tasks/' + encodeURIComponent(${JSON.stringify(id)}) + '/claim', { method:'PATCH', credentials:'include', headers });\n      if (res.status === 404) return { kind: 'http', status: 404, where: '/tasks/:id/claim (task not found)' };\n      if (res.status === 403) return { kind: 'http', status: 403, where: '/tasks/:id/claim (forbidden — not your task, terminal status, or channel archived)' };\n      if (res.status === 409) return { kind: 'http', status: 409, where: '/tasks/:id/claim (conflict — already claimed by someone else; use task-unclaim first)' };\n      if (!res.ok) return { kind: res.status===401?'auth':'http', status: res.status, where:'/tasks/:id/claim' };\n      const data = await res.json().catch(() => ({}));\n      // F5 — qatester live dump: server wraps the task as { task: {...} }.\n      // Unwrap so the command surfaces the inner row, otherwise every column\n      // resolves to null even though the claim succeeded.\n      const t = (data && data.task) ? data.task : data;\n      return { kind: 'ok', rows: [t] };\n    `;\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    const rows = dispatchEvaluateResult(result);\n    return rows.map((t) => ({","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/task-claim.js#L17-L53","documentation":"task-claim validates its taskId with assertMessageIdShape and rethrows any failure as an ArgumentError with a suffix noting the rethrow origin and that taskId must be a full UUID. This catches empty strings, short ids, or otherwise malformed task identifiers before any network call.","triggerScenarios":"Running task-claim with a missing/empty taskId, a short display id (e.g. '42') instead of the full UUID, a '#channel:shortId' form, or text copied without the UUID portion.","commonSituations":"Copying the human-friendly task number from 'task #42' output instead of the UUID column; truncating the UUID in terminal output; mixing up message ids and task ids.","solutions":["Pass the full task UUID (from the taskId column of task-list/task-get output).","If you only have a task number, run task-get with channel+number to look up the UUID first.","Inspect the inner e.message (it precedes the 'rethrown from assertMessageIdShape' suffix) for the exact shape mismatch."],"exampleFix":"// before\nslock task-claim 42\n// after\nslock task-claim 9f3c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f","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;\nif (!UUID_RE.test(taskId)) throw new Error(`taskId must be a full UUID, got: ${taskId}`);","typeGuard":"const isUuid = (v) => typeof v === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v);","tryCatchPattern":"try {\n  await cli('task-claim', taskId);\n} catch (e) {\n  if (e instanceof ArgumentError && e.message.includes('assertMessageIdShape')) {\n    console.error('taskId must be the full UUID — look it up via task-get (channel + number).');\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Always take ids from the taskId column, never the human 'task #N' label.","Validate UUID shape with a regex before passing ids to CLI commands.","Avoid copying ids from terminal output that may be truncated; widen columns or export JSON."],"tags":["cli","uuid","argument-validation"],"backgroundTag":"invalid-uuid-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}