{"record":{"id":"18cbbff135264006","repo":"ruvnet/ruflo","slug":"result-error-agent-execute-failed","errorCode":null,"errorMessage":"${result.error || 'agent_execute failed'}","messagePattern":"\\$\\{result\\.error \\|\\| 'agent_execute failed'\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts","lineNumber":365,"sourceCode":"\n        let stepEntry: typeof stepResults[number] = { stepId: step.stepId, type: step.type, status: 'running' };\n\n        try {\n          if (step.type === 'task') {\n            const cfg = step.config as Record<string, unknown>;\n            const agentId = (cfg.agentId as string) || (workflow.variables.defaultAgentId as string);\n            const promptTpl = (cfg.prompt as string) || step.name;\n            if (!agentId) throw new Error(`task step ${step.stepId} requires config.agentId or workflow.variables.defaultAgentId`);\n            const prompt = interp(promptTpl);\n            const result = await executeAgentTask({\n              agentId,\n              prompt,\n              systemPrompt: cfg.systemPrompt ? interp(String(cfg.systemPrompt)) : undefined,\n              maxTokens: cfg.maxTokens as number | undefined,\n              temperature: cfg.temperature as number | undefined,\n              timeoutMs: cfg.timeoutMs as number | undefined,\n            });\n            if (!result.success) throw new Error(result.error || 'agent_execute failed');\n            step.result = result;\n            workflow.variables[`${step.stepId}.output`] = result.output;\n            workflow.variables.lastStepOutput = result.output;\n            stepEntry = { stepId: step.stepId, type: 'task', status: 'completed', durationMs: result.durationMs, output: result.output };\n          } else if (step.type === 'wait') {\n            const cfg = step.config as Record<string, unknown>;\n            const ms = Math.min(Math.max(0, (cfg.ms as number) || 0), 60000);\n            await new Promise(r => setTimeout(r, ms));\n            step.result = { waitedMs: ms };\n            stepEntry = { stepId: step.stepId, type: 'wait', status: 'completed', durationMs: ms };\n          } else if (step.type === 'condition') {\n            // Simple condition: config.when is a JS expression evaluated against workflow.variables.\n            // For safety, we only support `var === 'value'` or `var === number`.\n            const cfg = step.config as Record<string, unknown>;\n            const expr = String(cfg.when || 'true').trim();\n            const m = expr.match(/^([a-zA-Z_][\\w]*)\\s*===?\\s*(['\\\"])?([^'\\\"]*)\\2?$/);\n            let truthy = false;\n            if (m) {","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts#L347-L383","documentation":"Error \"${result.error || 'agent_execute failed'}\" thrown in ruvnet/ruflo.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts:365 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}