ComposioHQ/composio · error · KeyringError

NoDefaultStore

NoDefaultStore

Error message

NoDefaultStore

What it means

getDefaultStore() throws KeyringError kind 'NoDefaultStore' because no CredentialStore implementation has been registered as the default. The keyring entry has no overrideStore and no global default was set.

Source

Thrown at ts/packages/cli-keyring/src/core/store.ts:100

 * The CLI calls this once at startup; tests call it to inject a mock.
 */
export function setDefaultStore(store: CredentialStore): void {
  defaultStore = store;
}

/** Clear the registered store — mostly useful for test teardown. */
export function unsetDefaultStore(): void {
  defaultStore = null;
}

/**
 * Return the active default store or throw `NoDefaultStore` if none is
 * registered. Callers that want a non-throwing check should use
 * `hasDefaultStore()` instead.
 */
export function getDefaultStore(): CredentialStore {
  if (defaultStore === null) {
    throw new KeyringError({ kind: 'NoDefaultStore' });
  }
  return defaultStore;
}

export function hasDefaultStore(): boolean {
  return defaultStore !== null;
}

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Register a default store during app startup before using Entry
  2. Pass an explicit overrideStore when constructing the Entry
  3. Guard with hasDefaultStore() before use

Example fix

// before
const e = new Entry('svc','user'); await e.getSecret();
// after
registerDefaultStore(myStore);
const e = new Entry('svc','user'); await e.getSecret();
Defensive patterns

Strategy: validation

Validate before calling

if (!hasDefaultStore()) registerDefaultStore(myStore);

Type guard

import { hasDefaultStore } from '.../store';
// hasDefaultStore(): boolean acts as the runtime guard

Try / catch

catch (e) { if (e instanceof KeyringError && e.kind === 'NoDefaultStore') { registerDefaultStore(fallback); retry(); } else throw e; }

Prevention

When it happens

Trigger: Creating an Entry without overrideStore and calling any secret operation before a registerDefaultStore(...)/set-default call ran.

Common situations: Forgetting to initialize the keyring store in a fresh process, or an init race where the entry is used before store registration.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/0c8150663bd9832f. Report an issue: GitHub.