gitroomhq/postiz-app · error · HttpException

Tool not found

Error message

Tool not found

What it means

The requested tool (methodName) is rejected unless it appears both in the integration manager's registered tools for that provider identifier AND exists as a callable member on the provider class. If either check fails, the API returns 404 'Tool not found'. This guards against invoking arbitrary method names on provider objects.

Source

Thrown at apps/backend/src/public-api/routes/v1/public.integrations.controller.ts:588

    const integrationProvider = socialIntegrationList.find(
      (p) => p.identifier === getIntegration.providerIdentifier
    )!;

    if (!integrationProvider) {
      throw new HttpException({ msg: 'Integration provider not found' }, 404);
    }

    const tools = this._integrationManager.getAllTools();
    if (
      // @ts-ignore
      !tools[integrationProvider.identifier]?.some(
        (p: any) => p.methodName === body.methodName
      ) ||
      // @ts-ignore
      !integrationProvider[body.methodName]
    ) {
      throw new HttpException({ msg: 'Tool not found' }, 404);
    }

    while (true) {
      try {
        // @ts-ignore
        const result = await integrationProvider[body.methodName](
          getIntegration.token,
          body.data || {},
          getIntegration.internalId,
          getIntegration
        );

        return { output: result };
      } catch (err) {
        if (err instanceof RefreshToken) {
          const data = await this._refreshIntegrationService.refresh(
            getIntegration
          );

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Fetch the available tools from the integration manager / provider metadata and only call methods present for that provider identifier
  2. Check exact methodName casing and spelling against the provider's tool definitions
  3. Upgrade the backend if the tool was introduced in a newer release
  4. Confirm the tool is valid for the integration's channel type

Example fix

// before
await triggerTool(integration.id, 'publishNow', {...}); // 404

// after
const tools = await getProviderTools(integration.providerIdentifier);
const tool = tools.find((t) => t.methodName === 'publishNow');
if (!tool) throw new Error('Tool not available for this channel');
await triggerTool(integration.id, tool.methodName, {...});
Defensive patterns

Strategy: type-guard

Validate before calling

const tools = await getProviderTools(integration.providerIdentifier);
const ok = tools.some((t) => t.methodName === body.methodName) && typeof (provider as any)?.[body.methodName] === 'function';
if (!ok) throw new Error(`Tool ${body.methodName} not available on ${integration.providerIdentifier}`);

Type guard

const isToolCallable = (provider: object, name: string): name is string =>
  name in provider && typeof (provider as any)[name] === 'function';

Try / catch

try {
  await triggerTool(id, method, args);
} catch (e: any) {
  if (e?.status === 404 && e?.response?.msg === 'Tool not found') {
    // fix methodName spelling/casing or pick a tool valid for this channel type
  } else throw e;
}

Prevention

When it happens

Trigger: POST to triggerIntegrationTool with a methodName that is not a registered tool (typo, wrong casing, wrong provider), or a tool that exists in code but is not registered via _integrationManager.getAllTools() for that provider in the running build.

Common situations: Calling a method that belongs to a different channel (e.g. a Discord-only tool on a Slack integration); methodName casing mismatch ('SendPost' vs 'sendPost'); tool added in a newer version than the deployed backend; using internal method names that are not exposed as tools.

Related errors


AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27). Data as JSON: /api/errors/ad7a9ba01aed57b7. Report an issue: GitHub.