{"record":{"id":"fe211a446aa99602","repo":"jackwener/OpenCLI","slug":"slock-task-status-returned-task-id-taskid-expe","errorCode":null,"errorMessage":"Slock task-status returned task id ${taskId}, expected ${expectedId}.","messagePattern":"Slock task-status returned task id (.+?), expected (.+?)\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/slock/task-status.js","lineNumber":83,"sourceCode":"    return rows.map((t) => {\n      const task = assertTaskMutationIdentity(t, id, status);\n      return {\n        taskId: task.taskId,\n        taskStatus: task.taskStatus,\n        assigneeId: t.claimedById ?? t.assigneeId ?? null,\n        taskNumber: t.taskNumber ?? null,\n      };\n    });\n  },\n});\n\nfunction assertTaskMutationIdentity(t, expectedId, expectedStatus) {\n  const taskId = t?.id;\n  if (!taskId) {\n    throw new CommandExecutionError(`Slock task-status succeeded without returning task id ${expectedId}; refusing to report a status row.`);\n  }\n  if (taskId !== expectedId) {\n    throw new CommandExecutionError(`Slock task-status returned task id ${taskId}, expected ${expectedId}.`);\n  }\n  const taskStatus = t.taskStatus ?? t.status;\n  if (!taskStatus) {\n    throw new CommandExecutionError(`Slock task-status returned task ${expectedId} without taskStatus.`);\n  }\n  if (taskStatus !== expectedStatus) {\n    throw new CommandExecutionError(`Slock task-status returned status ${taskStatus}, expected ${expectedStatus}.`);\n  }\n  return { taskId, taskStatus };\n}\n","sourceCodeStart":65,"sourceCodeEnd":94,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/task-status.js#L65-L94","documentation":"assertTaskMutationIdentity compares the `id` of the task object returned by the task-status API against the task id the user asked about. This throw fires when the API succeeded but returned a DIFFERENT task id than requested, so the command refuses to show a misleading status row.","triggerScenarios":"Running `slock task-status <id>` when the endpoint resolves a different task (wrong id passed, server override (`--server`) pointing at a different backend with colliding ids, or a cache/proxy serving a stale or rewritten record).","commonSituations":"Copy/paste of a task id from another server; using a short id where the API silently matched a different record; switching active servers with `--server` while reusing old ids; API routing bugs after version upgrades.","solutions":["Re-check the task id you passed; fetch the canonical id from `task-list` on the same server.","Remove or correct the `--server` override so you query the backend the id belongs to.","Confirm no middleware rewrites request/response bodies between the browser page and the API.","Capture the returned id from the error message and inspect that task to identify the mixup."],"exampleFix":"// before\nawait cli.run(['task-status', oldId]);\n// after: resolve the id on the target server first\nconst rows = await cli.run(['task-list', '--server', 'prod']);\nconst id = rows.find(r => r.taskNumber === 42).taskId;\nawait cli.run(['task-status', id]);","handlingStrategy":"validation","validationCode":"const known = await cli.run(['task-list', '--server', server]);\nif (!known.some(r => r.taskId === id)) throw new Error(`unknown task id ${id} on ${server}`);","typeGuard":null,"tryCatchPattern":"try {\n  await cli.run(['task-status', id, '--server', server]);\n} catch (e) {\n  if (String(e.message).includes('expected')) {\n    const m = e.message.match(/returned task id ([^,]+)/);\n    console.error(`id mixup: got ${m?.[1]}, wanted ${id}`);\n  } else throw e;\n}","preventionTips":["Resolve ids from task-list on the same server before mutating","Avoid reusing ids across --server overrides","Watch for proxies that rewrite bodies"],"tags":["identity-mismatch","api-response","task-id"],"backgroundTag":"response-identity-mismatch","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}