{"record":{"id":"966336ad2dfa6a30","repo":"FlowiseAI/Flowise","slug":"e-966336","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/agentflow/Tool/Tool.ts","lineNumber":348,"sourceCode":"            newState = processTemplateVariables(newState, toolOutput)\n\n            const returnOutput = {\n                id: nodeData.id,\n                name: this.name,\n                input: {\n                    toolInputArgs: toolInput ?? toolInputArgs,\n                    selectedTool: selectedTool\n                },\n                output: {\n                    content: toolOutput,\n                    artifacts: parsedArtifacts\n                },\n                state: newState\n            }\n\n            return returnOutput\n        } catch (e) {\n            throw new Error(e)\n        }\n    }\n}\n\nmodule.exports = { nodeClass: Tool_Agentflow }\n","sourceCodeStart":330,"sourceCodeEnd":354,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/agentflow/Tool/Tool.ts#L330-L354","documentation":"Tool_Agentflow.run()'s catch block re-throws any exception from tool execution as `new Error(e)`, stringifying the original error and losing its stack/type. The returnOutput built before the failure is discarded.","triggerScenarios":"The dynamically-imported tool's run() throws: the tool's own credential is missing, the tool's API call fails, the tool module fails to import (bad filePath), or tool input args are malformed.","commonSituations":"Selected tool lacks a credential (e.g. SerpAPI without API key); tool's external API is down/rate-limited; tool component path changed after upgrade; tool expects args that the flow did not supply.","solutions":["Run the referenced tool as a standalone node to see its real error.","Verify the tool's credential is configured and valid.","Check tool input args (toolInput) are present and correctly typed.","Confirm the tool module still exists at the filePath after any upgrade.","Patch to `throw new Error(e instanceof Error ? e.message : String(e), { cause: e })` to preserve causality."],"exampleFix":"// before\n        } catch (e) {\n            throw new Error(e)\n        }\n// after\n        } catch (e) {\n            throw new Error(e instanceof Error ? e.message : String(e), { cause: e })\n        }","handlingStrategy":"try-catch","validationCode":"const tool = nodeData.inputs?.selectedTool\nconst mod = options.componentNodes?.[tool]\nif (!mod?.filePath) throw new Error(`Tool ${tool} is missing a filePath; cannot import`)","typeGuard":null,"tryCatchPattern":"try {\n  await toolNode.run(nodeData, input, options)\n} catch (e) {\n  // original tool error stringified; reproduce by calling the tool directly\n  throw e\n}","preventionTips":["Configure each tool's credential before referencing it.","Test the referenced tool standalone first.","Keep tool component filePaths stable across upgrades.","Validate toolInput args are present before the Tool node runs."],"tags":["agentflow","tool-node","error-wrapping","stack-trace-loss"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}