mastra-ai/mastra · error
Failed to check whether Slack app exists: ${data.error ?? 'u
Error message
Failed to check whether Slack app exists: ${data.error ?? 'unknown_error'} What it means
appExists checks whether the Slack app still exists. It returns false for the expected 'not found' errors (app_not_found, invalid_app_id) but any OTHER error is unexpected — it could be transient — so the client re-throws rather than reporting false, preventing callers from tearing down a valid installation on a temporary failure.
Source
Thrown at channels/slack/src/client.ts:228
});
const data = (await response.json()) as {
ok: boolean;
error?: string;
};
if (data.ok) return true;
// Only a definitive "app is gone" answer counts as non-existence. Slack
// returns `app_not_found` when the app was deleted and `invalid_app_id`
// when the id is malformed. Any other error (rate limiting, auth, outage)
// is transient — re-throw so callers don't tear down a valid installation
// on a temporary failure.
if (data.error === 'app_not_found' || data.error === 'invalid_app_id') {
return false;
}
throw new Error(`Failed to check whether Slack app exists: ${data.error ?? 'unknown_error'}`);
}
/**
* Update an existing Slack app's manifest.
*/
async updateApp(appId: string, manifest: SlackAppManifest): Promise<void> {
await this.rotateToken();
const response = await fetch(`${SLACK_API_BASE}/apps.manifest.update`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.#token}`,
},
body: JSON.stringify({ app_id: appId, manifest }),
signal: AbortSignal.timeout(SLACK_API_TIMEOUT_MS),
});
View on GitHub (pinned to 75dd419e61)
Solutions
- Retry the connect/appExists call after a short backoff — the error is often transient
- Verify app configuration tokens are valid (invalid_auth → get fresh tokens from the Slack app config)
- Check Slack's status page if errors persist, and only treat the app as missing when appExists returns false
Example fix
// before
const exists = await client.appExists(appId); // throws on transient error
// after
let exists: boolean;
try { exists = await client.appExists(appId); }
catch (e) { exists = true; /* assume exists; don't tear down on transient failure */ } Defensive patterns
Strategy: fallback
Try / catch
let exists: boolean;
try {
exists = await client.appExists(appId);
} catch (e) {
// transient failure: assume the app exists rather than tearing down a valid install
logger.warn({ err: e }, 'appExists check failed; assuming exists');
exists = true;
} Prevention
- Never treat a thrown appExists error as 'app missing'
- Add backoff/retry around connect flows
- Refresh app configuration tokens when invalid_auth appears
- Distinguish the safe false return (app_not_found/invalid_app_id) from thrown errors
When it happens
Trigger: appExists() (called from connect) receives { ok: false, error: X } where X is neither app_not_found nor invalid_app_id — e.g. fatal_error, invalid_auth, rateLimited, network-level issues surfaced as Slack errors.
Common situations: Slack API outage or rate limiting during channel connect; bad/expired app configuration token; intermittent network failures in deployment environments.
Related errors
- Token rotation failed: ${data.error}
- App creation failed: ${errorDetails}
- App deletion failed: ${data.error}
- Slack refresh token is invalid. Get fresh tokens from https:
- Token rotation returned incomplete data
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/e34ce8d3b0229a58.
Report an issue: GitHub.