jackwener/OpenCLI · error · ArgumentError
${e.message} (rethrown from assertMessageIdShape; e.g. taskI
Error message
${e.message} (rethrown from assertMessageIdShape; e.g. taskId is not a full UUID) What it means
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.
Source
Thrown at clis/slock/task-claim.js:35
cli({
site: SLOCK_SITE,
name: 'task-claim',
access: 'write',
description: 'Claim a chat task (PATCH /tasks/:id/claim). Requires full task UUID (= message id).',
domain: SLOCK_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
args: [
{ name: 'taskId', positional: true, required: true, help: 'Full task UUID (= message id; short ids rejected)' },
{ name: 'server', help: 'Override active server' },
],
columns: ['taskId', 'taskStatus', 'assigneeId', 'taskNumber'],
func: async (page, kwargs) => {
let id;
try { id = assertMessageIdShape(String(kwargs.taskId ?? '')); }
catch (e) { throw new ArgumentError(e.message); }
await page.goto(SLOCK_HOME_URL);
const snippet = `
${authHeadersFragment({ serverScoped: true, serverIdOverride: kwargs.server })}
const res = await fetch('${SLOCK_API_BASE}/tasks/' + encodeURIComponent(${JSON.stringify(id)}) + '/claim', { method:'PATCH', credentials:'include', headers });
if (res.status === 404) return { kind: 'http', status: 404, where: '/tasks/:id/claim (task not found)' };
if (res.status === 403) return { kind: 'http', status: 403, where: '/tasks/:id/claim (forbidden — not your task, terminal status, or channel archived)' };
if (res.status === 409) return { kind: 'http', status: 409, where: '/tasks/:id/claim (conflict — already claimed by someone else; use task-unclaim first)' };
if (!res.ok) return { kind: res.status===401?'auth':'http', status: res.status, where:'/tasks/:id/claim' };
const data = await res.json().catch(() => ({}));
// F5 — qatester live dump: server wraps the task as { task: {...} }.
// Unwrap so the command surfaces the inner row, otherwise every column
// resolves to null even though the claim succeeded.
const t = (data && data.task) ? data.task : data;
return { kind: 'ok', rows: [t] };
`;
const result = await page.evaluate(`(async () => { ${snippet} })()`);
const rows = dispatchEvaluateResult(result);
return rows.map((t) => ({View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before slock task-claim 42 // after slock task-claim 9f3c1a2e-4b5d-4c6e-8f70-1a2b3c4d5e6f
Defensive patterns
Strategy: validation
Validate before calling
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (!UUID_RE.test(taskId)) throw new Error(`taskId must be a full UUID, got: ${taskId}`); Type guard
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); Try / catch
try {
await cli('task-claim', taskId);
} catch (e) {
if (e instanceof ArgumentError && e.message.includes('assertMessageIdShape')) {
console.error('taskId must be the full UUID — look it up via task-get (channel + number).');
process.exitCode = 2;
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- id not a valid Grok session ID (got "${input}"); expected a
- ${e.message} (rethrown from assertMessageIdShape; e.g. taskI
- <train-no> "${trainNo}" does not look like a 12306 internal
- --from station must not be empty
- --to station must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1c387b8c3f7fc3ee.
Report an issue: GitHub.