JuliusBrussee/caveman · error

recordOutcome: evidence.${key} must be a string, number, or

Error message

recordOutcome: evidence.${key} must be a string, number, or boolean

What it means

Error "recordOutcome: evidence.${key} must be a string, number, or boolean" thrown in JuliusBrussee/caveman.

Source

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

  client: CavemanOutcomeClient,
  input: RecordOutcomeInput,
): Promise<RecordOutcomeResult> {
  const controlApiUrl = requireBaseUrl(client.controlApiUrl, "recordOutcome: controlApiUrl");
  const token = requireNonEmpty(client.token, "recordOutcome: token");
  const projectId = requireNonEmpty(client.projectId, "recordOutcome: projectId");
  const taskId = requireNonEmpty(input.taskId, "recordOutcome: taskId");
  const contract = requireNonEmpty(input.contract, "recordOutcome: contract");

  if (!isPlainObject(input.values) || Object.keys(input.values).length === 0) {
    throw new Error("recordOutcome: values must be a non-empty plain object");
  }
  if (!isPlainObject(input.evidence)) {
    throw new Error("recordOutcome: evidence must be a plain object");
  }
  const evidenceRefs = Object.entries(input.evidence).map(([key, value]) => {
    if (!key.trim()) throw new Error("recordOutcome: evidence keys must be non-empty");
    if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
      throw new Error(`recordOutcome: evidence.${key} must be a string, number, or boolean`);
    }
    if (typeof value === "number" && !Number.isFinite(value)) {
      throw new Error(`recordOutcome: evidence.${key} must be a finite number`);
    }
    const ref = `${key}:${String(value)}`;
    if (!ref.slice(key.length + 1)) throw new Error(`recordOutcome: evidence.${key} must be non-empty`);
    return ref;
  });
  if (evidenceRefs.length === 0) {
    throw new Error("recordOutcome: evidence must contain at least one reference");
  }
  if (evidenceRefs.length > MAX_EVIDENCE_REFS) {
    throw new Error(`recordOutcome: evidence must contain at most ${MAX_EVIDENCE_REFS} references`);
  }

  const confidence = input.confidence;
  if (typeof confidence !== "number" || !Number.isFinite(confidence) || confidence < 0 || confidence > 1) {
    throw new Error("recordOutcome: confidence is required and must be a number within [0,1]");

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Pass evidence values that are strings, numbers, or booleans only.

When it happens

Trigger: Thrown at packages/mastra/src/index.ts:658 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/707b8445b9af22e7. Report an issue: GitHub.