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
status | HTTP status |
message | What went wrong, in words |
code | Machine-readable, where one applies |
isQuotaExceeded | 402, monthly allowance spent |
isRateLimited | 429, too fast |
isAuthError | 401 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 "";
}
}