{"record":{"id":"001f20574f02f145","repo":"ComposioHQ/composio","slug":"app-name-is-not-defined","errorCode":null,"errorMessage":"App name is not defined","messagePattern":"App name is not defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/providers/langchain/src/index.ts","lineNumber":130,"sourceCode":"   *   tools: [langchainTool]\n   * });\n   *\n   * const executor = new AgentExecutor({\n   *   agent,\n   *   tools: [langchainTool]\n   * });\n   *\n   * const result = await executor.invoke({\n   *   input: \"Search for information about Composio\"\n   * });\n   * ```\n   */\n  wrapTool(tool: Tool, executeTool: ExecuteToolFn): DynamicStructuredTool {\n    const toolName = tool.slug;\n    const description = tool.description;\n    const appName = tool.toolkit?.name?.toLowerCase();\n    if (!appName) {\n      throw new Error('App name is not defined');\n    }\n    const func = async (...args: unknown[]): Promise<unknown> => {\n      // Models occasionally emit tool input as a JSON string rather than an object (issue #2406).\n      const result = await executeTool(toolName, normalizeToolArguments(args[0], toolName));\n      return JSON.stringify(result);\n    };\n    if (!tool.inputParameters) {\n      throw new Error('Tool input parameters are not defined');\n    }\n    const parameters = jsonSchemaToZodSchema(\n      dereferenceJsonSchema(tool.inputParameters, { onUnresolved: 'sentinel' })\n    );\n\n    // See https://github.com/langchain-ai/langchainjs/issues/8468 and pnpm-workspace.yaml.\n    // @ts-expect-error: error TS2589: Type instantiation is excessively deep and possibly infinite.\n    return new DynamicStructuredTool({\n      name: toolName,\n      description: description || '',","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/providers/langchain/src/index.ts#L112-L148","documentation":"The LangChain provider's wrapTool requires tool.toolkit?.name to build the namespaced tool name; if the toolkit object or its name is missing (e.g. the tool was fetched without toolkit expansion), it throws 'App name is not defined'.","triggerScenarios":"Calling ComposioLangchain.wrapTools/wrapTool with Tool objects whose toolkit is undefined or toolkit.name is empty — common when tools come from a source that omits toolkit metadata.","commonSituations":"Fetching tools by slug without including toolkit info; backend response missing toolkit metadata; constructing Tool objects manually or from cached/serialized data that dropped nested toolkit fields; SDK version mismatch in Tool shape.","solutions":["Fetch tools through the SDK so toolkit metadata is populated (ensure the request expands toolkit fields)","Log/inspect tool.toolkit before wrapTools and filter out or fix tools lacking toolkit.name","Upgrade @composio/core and the LangChain provider together so the Tool shape matches","If a specific tool consistently lacks a toolkit, report it — it may be a backend metadata bug"],"exampleFix":"// before\nconst tools = await composio.tools.get({ toolSlugs: ['GITHUB_STAR_REPO'] }); // toolkit possibly undefined\n// after\nconst tools = await composio.tools.get({ toolSlugs: ['GITHUB_STAR_REPO'] });\nconst valid = tools.items.filter((t) => t.toolkit?.name);\nif (valid.length !== tools.items.length) console.warn('Some tools missing toolkit metadata');\nconst lcTools = await langchainWrap.wrapTools(valid, execute);","handlingStrategy":"type-guard","validationCode":"const hasToolkitName = (t: Tool): boolean => Boolean(t.toolkit?.name);","typeGuard":"function hasToolkit(t: Tool): t is Tool & { toolkit: { name: string } } { return typeof t.toolkit?.name === 'string' && t.toolkit.name.length > 0; }","tryCatchPattern":"try { await provider.wrapTools(tools, execute); } catch (e) { if ((e as Error).message === 'App name is not defined') { tools = tools.filter(hasToolkit); /* retry */ } throw e; }","preventionTips":["Filter tools on toolkit?.name before wrapTools","Fetch tools via SDK APIs that include toolkit metadata","Keep core and provider package versions in sync"],"tags":["langchain","provider","toolkit-metadata","typescript"],"backgroundTag":"missing-required-field","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}