redis/node-redis · warning · Error
TokenManager is not running but received an error
Error message
TokenManager is not running but received an error: ${errorMessage} What it means
The error-path twin of error 7. notifyError delivers an IDP error to listener.onError; when the listener is null (manager stopped) it throws instead. Triggered when an in-flight requestToken() rejects after stop() has cleared the listener.
Solutions
- Await in-flight refresh before stop().
- Catch and log this specific error during teardown.
- Make stop() cancel pending token requests rather than letting them resolve later.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await manager.refresh();
} catch (err) {
if (/not running.*error/i.test(err.message)) {
// teardown race; safe to ignore
return;
}
throw err;
} Prevention
- Await in-flight refresh before stop().
- Treat 'not running but received an error' as a teardown-time signal, not a production failure.
- Cancel pending token requests in stop() rather than letting them resolve later.
When it happens
Trigger: stop() called while requestToken() is pending; the request later rejects (network/credentials) and the rejection surfaces through notifyError with no listener attached.
Common situations: Teardown during an IDP outage; IDP rejecting concurrently with shutdown; retry timer firing after stop.
Related errors
- TokenManager is not running, but a new token was received
- TokenManager is not running, but refresh was called
- expirationRefreshRatio must be greater or equal to 0
- expirationRefreshRatio must be less than or equal to 1
- The client is closed
AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11).
Data as JSON: /api/errors/645e2f05c8eb935e.
Report an issue: GitHub.
Appendix: source
Thrown at packages/client/lib/authx/token-manager.ts:314
}
this.listener = null;
this.currentToken = null;
this.retryAttempt = 0;
}
/**
* Returns the current token or null if no token is available.
*/
public getCurrentToken(): Token<T> | null {
return this.currentToken;
}
private notifyError(error: unknown, isRetryable: boolean): void {
const errorMessage = error instanceof Error ? error.message : String(error);
if (!this.listener) {
throw new Error(`TokenManager is not running but received an error: ${errorMessage}`);
}
this.listener.onError(new IDPError(errorMessage, isRetryable));
}
}View on GitHub (pinned to 90fd0652bc)