JuliusBrussee/caveman · error

recordOutcome: no global fetch; pass client.fetch

Error message

recordOutcome: no global fetch; pass client.fetch

What it means

Error "recordOutcome: no global fetch; pass client.fetch" thrown in JuliusBrussee/caveman.

Source

Thrown at packages/mastra/src/index.ts:723

  );

  const text = await response.text();
  const ok = response.ok ?? (response.status >= 200 && response.status < 300);
  if (!ok) throw new CavemanOutcomeError(response.status, text);

  let parsed: { data?: unknown; created?: unknown };
  try {
    parsed = JSON.parse(text) as { data?: unknown; created?: unknown };
  } catch {
    throw new CavemanOutcomeError(response.status, text);
  }
  return { status: response.status, created: parsed.created === true, record: parsed.data ?? null };
}

function globalFetch(url: string, init: RequestInitLike): Promise<ResponseLike> {
  const fetchImpl = (globalThis as { fetch?: (u: string, i: unknown) => Promise<ResponseLike> }).fetch;
  if (typeof fetchImpl !== "function") {
    throw new Error("recordOutcome: no global fetch; pass client.fetch");
  }
  return fetchImpl(url, init);
}

/**
 * JSON with object keys sorted at every level. Throws on anything that is not a
 * plain object, array, string, finite number, boolean, or null — a Date, a Map,
 * or a class instance would serialize into something the caller did not mean,
 * and the record's digest is its identity.
 */
export function stableStringify(value: unknown, path = "value"): string {
  if (value === null) return "null";
  switch (typeof value) {
    case "string":
      return JSON.stringify(value);
    case "boolean":
      return value ? "true" : "false";
    case "number":

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Provide client.fetch or run in an environment with global fetch.

When it happens

Trigger: Thrown at packages/mastra/src/index.ts:723 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/83f3243bc4e73575. Report an issue: GitHub.