mastra-ai/mastra · error
Method not implemented
Error message
Method not implemented
What it means
getApiClient on the base MastraIntegration class is a stub that throws 'Method not implemented' (note: without the trailing period of its siblings). Concrete integrations are expected to return their typed API client; the base class has none to give. It exists so the integration interface is uniform across integrations.
Source
Thrown at packages/core/src/integration/integration.ts:49
};
}, {});
}
return this.workflows;
}
/**
* TOOLS
*/
listStaticTools(_params?: ToolsParams): Record<string, ToolAction<any, any, any>> {
throw new Error('Method not implemented.');
}
async listTools(_params?: ToolsParams): Promise<Record<string, ToolAction<any, any, any>>> {
throw new Error('Method not implemented.');
}
async getApiClient(): Promise<ApiClient> {
throw new Error('Method not implemented');
}
}
View on GitHub (pinned to 75dd419e61)
Solutions
- Override getApiClient() in your integration subclass to return the constructed API client
- Feature-detect the override before calling, or maintain a registry of integrations known to expose clients
- Construct the client yourself if you own the integration config (e.g. instantiate the generated OpenAPI client directly)
- Wrap in try/catch where integrations are heterogeneous
Example fix
// before
class MyIntegration extends MastraIntegration {}
// after
class MyIntegration extends MastraIntegration {
async getApiClient() {
return new MyApiClient(this.config);
}
} Defensive patterns
Strategy: type-guard
Validate before calling
if (integration.getApiClient === MastraIntegration.prototype.getApiClient) {
throw new Error(`${integration.name} does not expose an API client`);
} Type guard
function exposesApiClient(integration) {
return typeof integration.getApiClient === 'function' &&
integration.getApiClient !== MastraIntegration.prototype.getApiClient;
} Try / catch
try {
const client = await integration.getApiClient();
} catch (e) {
if (e.message.startsWith('Method not implemented')) {
// integration has no client — handle clientless path
} else {
throw e;
}
} Prevention
- Override getApiClient in integrations that have a backing API
- Keep a registry/flag of which integrations expose clients
- Do not assume client availability in generic integration loops
- Note the base stub's message lacks a trailing period — don't match it too strictly
When it happens
Trigger: Calling await integration.getApiClient() on the base MastraIntegration or a subclass that never overrode it — e.g. code that assumes every integration exposes an API client and requests it for direct HTTP calls.
Common situations: A custom integration that only implements tools but not the client; generic integration loops fetching clients for logging or health checks; calling getApiClient during development of a new integration.
Related errors
- Method not implemented.
- API not implemented
- MastraFactory: duplicate integration id '${integration.id}'
- MastraFactory: integration tool '${name}' from '${ownerId}'
- MastraFactory: integrations [${channelRegistrations.map(({ i
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/4684c34381224b37.
Report an issue: GitHub.