mastra-ai/mastra · error
No Slack installation found for agent "${agentId}"
Error message
No Slack installation found for agent "${agentId}" What it means
SlackProvider.listInstallations/getInstallation-style APIs look up stored installation records for a specific agentId. This error means storage returned records for the Slack platform but none had the requested agentId, so no Slack workspace has ever been connected for that agent. The library throws it instead of returning an empty/undefined installation so callers fail fast rather than acting on a missing connection.
Source
Thrown at channels/slack/src/provider.ts:1225
return {
type: 'oauth' as const,
installationId,
authorizationUrl,
};
}
/**
* Disconnect an agent from Slack by deleting its app.
*/
async disconnect(agentId: string): Promise<void> {
const client = this.#requireManifestClient();
const storage = await this.#getStorage();
const allRecords = await storage.listInstallations(PLATFORM);
const agentRecords = allRecords.filter(r => r.agentId === agentId);
if (agentRecords.length === 0) {
throw new Error(`No Slack installation found for agent "${agentId}"`);
}
for (const record of agentRecords) {
if (record.status === 'active') {
const installation = this.#decryptInstallation(this.#parseInstallation(record));
// Delete the app from Slack
try {
await client.deleteApp(installation.appId);
} catch (err) {
console.warn(`[Slack] Failed to delete Slack app ${installation.appId}:`, err);
}
// Remove adapter and command handlers
this.#adapters.delete(installation.id);
this.#slashCommands.delete(installation.webhookId);
}
View on GitHub (pinned to 75dd419e61)
Solutions
- List all installations via storage.listInstallations(PLATFORM) and confirm the exact agentId stored on the records.
- Install the Slack app for the correct agent (complete the OAuth flow) so an installation record with that agentId exists.
- Fix the agentId being passed in — match it exactly to the one used during installation.
- Point the provider at the storage backend that actually contains the installation.
Example fix
// before
const installation = await provider.getInstallation('support-agent');
// after
const records = await storage.listInstallations(PLATFORM);
const match = records.find(r => r.agentId === 'support-agent');
if (!match) {
await provider.install({ agentId: 'support-agent' }); // run OAuth first
} Defensive patterns
Strategy: validation
Validate before calling
const records = await storage.listInstallations('slack');
if (!records.some(r => r.agentId === agentId)) {
throw new Error(`Slack not installed for agent ${agentId}; run the install flow first`);
} Try / catch
try {
const installation = await provider.getInstallation(agentId);
} catch (e) {
if (e instanceof Error && e.message.includes('No Slack installation found')) {
await startSlackInstallFlow(agentId); // kick off OAuth
} else throw e;
} Prevention
- Store the agentId used at install time alongside the agent and reuse it verbatim.
- List installations at startup and log any agents without a Slack connection.
- Keep dev/prod storage backends consistent to avoid 'missing install' surprises.
When it happens
Trigger: Calling a SlackProvider public API (e.g. getting an installation/credentials for an agent) with an agentId that has zero installation records in storage; agentId typo or an agent created after the Slack app was installed under a different agentId.
Common situations: Renaming or recreating an agent and forgetting to re-install the Slack app for the new agentId; querying the wrong storage backend (dev DB vs prod); passing a Mastra agent name where the recorded agentId is its ID.
Related errors
- SlackProvider baseUrl not available during OAuth callback
- Redirect URI is required for SSO login
- Google client ID is required. Provide it in the options or s
- Redirect URI is required for Google SSO. Set GOOGLE_REDIRECT
- Slack refresh token is invalid. Get fresh tokens from https:
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/3966e1a6c625e9e3.
Report an issue: GitHub.