Cloud The core runtime is open source and free. TekMemo Cloud (hosted sync, managed MCP, team features) is in early access. Join the waitlist →
Skip to content

Errors

TekMemo Cloud APIs return structured errors designed to be predictable and easy to log.

Error shape

A standard error response follows the { error, meta } envelope format:

json
{
  "error": {
    "code": "bad_request",
    "message": "The request payload was invalid.",
    "details": {
      "reason": "Missing required field: 'projectId'"
    }
  },
  "meta": {
    "requestId": "req_123abc"
  }
}

The SDK transport automatically unwraps these envelopes — it returns the data payload directly on success, and throws a typed TekMemoCloudError on failure. You do not need to parse envelopes yourself.

Typed error classes

The cloud client maps HTTP status codes to specific error classes, all extending TekMemoCloudError:

ClassHTTP StatusMeaning
TekMemoCloudValidationError400, 422The request was malformed or failed validation.
TekMemoCloudAuthError401Authentication failed. Check your TEKMEMO_API_KEY.
TekMemoCloudPermissionError403You do not have permission to access this resource or project.
TekMemoCloudNotFoundError404The requested memory, project, or node was not found.
TekMemoCloudConflictError409A sync conflict occurred or the resource already exists.
TekMemoCloudRateLimitError429Too many requests. Check retryAfterMs.
TekMemoCloudServerError500+An unexpected server error occurred.

Non-HTTP errors:

ClassMeaning
TekMemoCloudNetworkErrorThe request could not reach the server.
TekMemoCloudTimeoutErrorThe request timed out.
TekMemoCloudResponseParseErrorThe server response could not be parsed.
TekMemoCloudConfigurationErrorThe client was misconfigured (e.g. missing baseUrl).

TekMemoCloudError properties

PropertyTypeDescription
codestringMachine-readable error code.
messagestringHuman-readable description.
status?numberHTTP status code.
requestId?stringCloud request ID for debugging.
retryAfterMs?numberSuggested retry delay (rate limits).
details?JsonValueStructured error context.

Using isTekMemoCloudError

ts
import { isTekMemoCloudError } from "@tekbreed/tekmemo";

try {
  await client.memory.readCore();
} catch (error) {
  if (isTekMemoCloudError(error)) {
    console.error(`[${error.status}] ${error.code}: ${error.message}`);
    if (error.requestId) console.error("Request:", error.requestId);
  }
}

Success and List Envelopes

Success responses also use a standard envelope with a meta object containing the requestId for debugging.

Single Resource

json
{
  "data": { "id": "note_123", "content": "..." },
  "meta": { "requestId": "req_456" }
}

Resource List (Pagination)

For list endpoints, the meta object includes pagination details.

json
{
  "data": [...],
  "meta": {
    "requestId": "req_789",
    "pagination": {
      "nextCursor": "cursor_xyz"
    }
  }
}

Security and redaction

By default, the cloud client strips upstream provider secrets and internal tokens from error messages before throwing them. Patterns redacted: tk_live_..., tm_live_..., Bearer ..., sk-..., pa-....

Rule: Never blindly log raw HTTP response bodies if you aren't using the official client, as some providers may echo keys back on failure.

Released under the MIT License.