mastra-ai/mastra · error
[Slack] Failed to resolve Mastra storage. Ensure your Mastra
Error message
[Slack] Failed to resolve Mastra storage. Ensure your Mastra instance has storage configured (e.g. LibSQLStore or PostgresStore). See https://mastra.ai/docs/storage
What it means
SlackProvider's #resolveStorage walks the attached Mastra instance looking for a configured storage backend (e.g. LibSQLStore or PostgresStore) or channel storage. If the lookup throws (e.g. the Mastra instance is present but storage access fails), it wraps the original error in this guidance message so developers know Slack requires persistent storage to track installations.
Source
Thrown at channels/slack/src/provider.ts:411
async #resolveStorage(): Promise<ChannelsStorage> {
// Try to get Mastra's channels storage
if (this.#mastra) {
try {
const store = this.#mastra.getStorage?.();
if (store) {
// Ensure storage is initialized (creates tables if needed)
await store.init();
const channelsStorage = (await store.getStore('channels')) as ChannelsStorage | undefined;
if (channelsStorage) {
this.#storage = channelsStorage;
this.#storageResolved = true;
return this.#storage;
}
}
} catch (err) {
throw new Error(
'[Slack] Failed to resolve Mastra storage. Ensure your Mastra instance has storage configured (e.g. LibSQLStore or PostgresStore). See https://mastra.ai/docs/storage',
{ cause: err },
);
}
}
throw new Error(
'[Slack] No storage available. SlackProvider requires persistent storage, configure a storage backend on your Mastra instance. See https://mastra.ai/docs/storage',
);
}
// ===========================================================================
// Storage Helpers - Parse/serialize between ChannelInstallation and typed Slack data
// ===========================================================================
/**
* Parse a ChannelInstallation record into a typed SlackInstallation.
*/View on GitHub (pinned to 75dd419e61)
Solutions
- Configure storage on your Mastra instance, e.g. new Mastra({ storage: new LibSQLStore({ url: 'file:./mastra.db' }) }).
- Check the 'cause' property of the thrown error to see the underlying storage failure and fix that (bad URL, permissions, driver missing).
- Verify the storage package is installed and the adapter constructor does not throw (test it standalone).
Example fix
// before
new Mastra({ agents });
// after
import { Mastra } from '@mastra/core';
import { LibSQLStore } from '@mastra/libsql';
new Mastra({ agents, storage: new LibSQLStore({ url: 'file:./mastra.db' }) }); Defensive patterns
Strategy: try-catch
Validate before calling
if (!mastra?.storage && !mastra?.channels?.storage) {
throw new Error('Configure storage on your Mastra instance before using SlackProvider');
} Type guard
function hasStorage(m: unknown): m is { storage: NonNullable<unknown> } {
return typeof m === 'object' && m !== null && 'storage' in m && m.storage != null;
} Try / catch
try {
await provider.initialize();
} catch (err) {
if (err instanceof Error && err.message.includes('Failed to resolve Mastra storage')) {
console.error('storage error cause:', (err as { cause?: unknown }).cause);
// fix the underlying storage adapter config
} else throw err;
} Prevention
- Always configure storage (LibSQLStore/PostgresStore) when using Slack channels.
- Check err.cause to diagnose the underlying adapter failure.
- Validate the storage adapter standalone (instantiate and query it) before wiring it into Mastra.
When it happens
Trigger: Calling any SlackProvider operation that needs storage (installation lookup, connect, webhook handling) when resolving storage from the Mastra instance throws — e.g. the storage adapter fails to initialize or the mastra.channels/mastra storage surface throws during resolution.
Common situations: Mastra instance constructed without a storage option; storage adapter configured with a bad connection URL that throws on use; misconfigured DI so the provider cannot find storage on the instance.
Related errors
- [Slack] No storage available. SlackProvider requires persist
- AcpAgent does not support resuming suspended generate calls
- ACP prompt stopped before completing: ${response.stopReason}
- MastraAuthBetterAuth needs a database to build its own bette
- 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/d73a5e96d194aadc.
Report an issue: GitHub.