{"record":{"id":"61e7573b3700568a","repo":"davila7/claude-code-templates","slug":"agent-not-found","errorCode":null,"errorMessage":"Agent not found","messagePattern":"Agent not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":756,"sourceCode":"        if (!session) return res.status(404).json({ error: 'Session not found' });\n\n        res.json({\n          tasks: session.tasks,\n          count: session.tasks.length\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load tasks' });\n      }\n    });\n\n    // Single teammate detail\n    this.app.get('/api/sessions/:id/teammates/:agentId', async (req, res) => {\n      try {\n        const session = await this.parseFullSession(req.params.id);\n        if (!session) return res.status(404).json({ error: 'Session not found' });\n\n        const agent = session.agents[req.params.agentId];\n        if (!agent) return res.status(404).json({ error: 'Agent not found' });\n\n        // Get agent-specific events\n        const agentEvents = session.events\n          .filter(e => e.agentId === req.params.agentId)\n          .slice(0, 100);\n\n        res.json({\n          ...agent,\n          recentEvents: agentEvents\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load teammate' });\n      }\n    });\n\n    // Main route\n    this.app.get('/', (req, res) => {\n      res.sendFile(path.join(__dirname, 'teams-dashboard-web', 'index.html'));","sourceCodeStart":738,"sourceCodeEnd":774,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L738-L774","documentation":"HTTP 404 from the teammate detail route when the session exists but session.agents[req.params.agentId] is undefined — the agentId doesn't match any agent key in that session.","triggerScenarios":"GET /api/sessions/:id/teammates/wrong-agent; using an agent name instead of the agentId key; agent list from a different session.","commonSituations":"UI passing display names instead of agent ids; stale agent list after session re-parse; case/format mismatch in the id.","solutions":["Fetch /api/sessions/:id and use an exact key from session.agents","Check the agentId format (key, not display name)","Refresh the UI's agent list for the current session"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const detail = await fetch(`/api/sessions/${id}`).then(r => r.json());\nif (!detail.agents?.[agentId]) throw new Error('unknown agent');","typeGuard":"const isKnownAgent = (detail, agentId) => Boolean(detail?.agents?.[agentId]);","tryCatchPattern":null,"preventionTips":["Use agent id keys from session.agents, not display names","Refresh the agent list when the session re-parses"],"tags":["http-404","teams-dashboard","express"],"backgroundTag":"resource-not-found","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}