{"record":{"id":"b77c5636d7439ff1","repo":"ruvnet/ruflo","slug":"user-not-found","errorCode":null,"errorMessage":"User not found","messagePattern":"User not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ruflo/src/ruvocal/src/lib/server/auth.ts","lineNumber":467,"sourceCode":"\t\t\ttoken: result.oauth?.token?.value,\n\t\t\tsessionId,\n\t\t\tsecretSessionId,\n\t\t\tisAdmin: result.user?.isAdmin || adminTokenManager.isAdmin(sessionId),\n\t\t};\n\t}\n\n\tif (isApi) {\n\t\tconst authorization = headers.get(\"Authorization\");\n\t\tif (authorization?.startsWith(\"Bearer \")) {\n\t\t\tconst token = authorization.slice(7);\n\t\t\tconst hash = await sha256(token);\n\t\t\tsessionId = secretSessionId = hash;\n\n\t\t\tconst cacheHit = await collections.tokenCaches.findOne({ tokenHash: hash });\n\t\t\tif (cacheHit) {\n\t\t\t\tconst user = await collections.users.findOne({ hfUserId: cacheHit.userId });\n\t\t\t\tif (!user) {\n\t\t\t\t\tthrow new Error(\"User not found\");\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tuser,\n\t\t\t\t\tsessionId,\n\t\t\t\t\ttoken,\n\t\t\t\t\tsecretSessionId,\n\t\t\t\t\tisAdmin: user.isAdmin || adminTokenManager.isAdmin(sessionId),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst response = await fetch(\"https://huggingface.co/api/whoami-v2\", {\n\t\t\t\theaders: { Authorization: `Bearer ${token}` },\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(\"Unauthorized\");\n\t\t\t}\n","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/lib/server/auth.ts#L449-L485","documentation":"task_update (simple implementation) starts with taskStore.get(input.taskId); a missing entry throws 'Task not found: <id>'. The store is the same process-local Map filled by task_create, and this handler runs only after an orchestrator attempt failed (visible as 'Failed to update task via orchestrator:' in server logs). Updates themselves are guarded separately: completed/cancelled tasks cannot be modified (error 1138), but a missing task never gets that far.","triggerScenarios":"Updating a task whose ID predates a server restart; orchestrator path failed and local store lacks the task; passing the wrong field as taskId (e.g. a dependency's ID); updating a task created in another coordinator instance.","commonSituations":"Long-lived agents that remember taskIds across server recycles; scripts editing tasks by hardcoded IDs; hybrid setups where some tasks live only in the orchestrator and the orchestrator connection drops mid-update.","solutions":["Re-create the task after a restart and update the new ID","Verify the ID via task list or task_status before calling task_update","If server logs show the orchestrator update failing, restore the orchestrator connection — the task may exist there but not in the local fallback","Track taskId -> status in your own state and discard IDs from dead processes"],"exampleFix":"// before\nawait client.callTool('task_update', { taskId, priority: 1 }); // stale id -> throws [1137]\n\n// after\nconst { tasks } = await client.callTool('task_list', { status: 'all' });\nconst live = tasks.find(t => t.description === originalDescription);\nif (!live) throw new Error('task lost to restart; re-create it');\nawait client.callTool('task_update', { taskId: live.id, priority: 1 });","handlingStrategy":"validation","validationCode":"const { tasks } = await client.callTool('task_list', { status: 'all' });\nconst updatable = tasks.find(t => t.id === taskId && t.status !== 'completed' && t.status !== 'cancelled');\nif (!updatable) throw new Error(`task ${taskId} missing or frozen`);","typeGuard":null,"tryCatchPattern":"try {\n  await client.callTool('task_update', { taskId, priority });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Task not found')) {\n    // store reset — re-create if this update still matters, otherwise drop it\n  } else throw e;\n}","preventionTips":["Update tasks in the process that created them; re-create after restarts","Batch your edits before a task reaches a terminal state","Distinguish this not-found from the frozen-status error (1138) — they need different handling"],"tags":["mcp","task","not-found","in-memory-state","orchestrator"],"backgroundTag":"task-not-found","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}