ComposioHQ/composio · error · Error

App name is not defined

Error message

App name is not defined

What it means

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'.

Source

Thrown at ts/packages/providers/langchain/src/index.ts:130

   *   tools: [langchainTool]
   * });
   *
   * const executor = new AgentExecutor({
   *   agent,
   *   tools: [langchainTool]
   * });
   *
   * const result = await executor.invoke({
   *   input: "Search for information about Composio"
   * });
   * ```
   */
  wrapTool(tool: Tool, executeTool: ExecuteToolFn): DynamicStructuredTool {
    const toolName = tool.slug;
    const description = tool.description;
    const appName = tool.toolkit?.name?.toLowerCase();
    if (!appName) {
      throw new Error('App name is not defined');
    }
    const func = async (...args: unknown[]): Promise<unknown> => {
      // Models occasionally emit tool input as a JSON string rather than an object (issue #2406).
      const result = await executeTool(toolName, normalizeToolArguments(args[0], toolName));
      return JSON.stringify(result);
    };
    if (!tool.inputParameters) {
      throw new Error('Tool input parameters are not defined');
    }
    const parameters = jsonSchemaToZodSchema(
      dereferenceJsonSchema(tool.inputParameters, { onUnresolved: 'sentinel' })
    );

    // See https://github.com/langchain-ai/langchainjs/issues/8468 and pnpm-workspace.yaml.
    // @ts-expect-error: error TS2589: Type instantiation is excessively deep and possibly infinite.
    return new DynamicStructuredTool({
      name: toolName,
      description: description || '',

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Fetch tools through the SDK so toolkit metadata is populated (ensure the request expands toolkit fields)
  2. Log/inspect tool.toolkit before wrapTools and filter out or fix tools lacking toolkit.name
  3. Upgrade @composio/core and the LangChain provider together so the Tool shape matches
  4. If a specific tool consistently lacks a toolkit, report it — it may be a backend metadata bug

Example fix

// before
const tools = await composio.tools.get({ toolSlugs: ['GITHUB_STAR_REPO'] }); // toolkit possibly undefined
// after
const tools = await composio.tools.get({ toolSlugs: ['GITHUB_STAR_REPO'] });
const valid = tools.items.filter((t) => t.toolkit?.name);
if (valid.length !== tools.items.length) console.warn('Some tools missing toolkit metadata');
const lcTools = await langchainWrap.wrapTools(valid, execute);
Defensive patterns

Strategy: type-guard

Validate before calling

const hasToolkitName = (t: Tool): boolean => Boolean(t.toolkit?.name);

Type guard

function hasToolkit(t: Tool): t is Tool & { toolkit: { name: string } } { return typeof t.toolkit?.name === 'string' && t.toolkit.name.length > 0; }

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/001f20574f02f145. Report an issue: GitHub.