Hivemind
TypeScript

Errors

What can go wrong, and how to branch on it.

ts
import { Hivemind, HivemindError } from "@get-hivemind/sdk";

try {
  await hm.remember({ content: "…" });
} catch (err) {
  if (err instanceof HivemindError && err.isQuotaExceeded) {
    // Reads still work. Only writes stopped.
  }
}

Properties

statusHTTP status
messageWhat went wrong, in words
codeMachine-readable, where one applies
isQuotaExceeded402, monthly allowance spent
isRateLimited429, too fast
isAuthError401 or 403

The ones you will actually hit

402, quota exceeded. Writes stop; reads, search and export keep working. Nothing is deleted. Degrade by skipping the write rather than failing the user's request.

429, rate limited. Retried automatically. Seeing it means a genuine burst — back off, or batch with rememberMany.

401. The key is wrong or revoked. Not retried, because retrying cannot fix it.

Failing softly

Memory is an enhancement. If it is unavailable, your agent should be slightly less informed, not broken:

ts
async function context(q: string): Promise<string> {
  try {
    const { payload } = await hm.recall({ q, budget: 2000 });
    return payload;
  } catch {
    return "";
  }
}