JuliusBrussee/caveman · error
recordOutcome: evidence must contain at most
Error message
recordOutcome: evidence must contain at most ${MAX_EVIDENCE_REFS} references What it means
Validation guard in recordOutcome: after mapping the caller's evidence object to key:value reference strings, the count exceeded MAX_EVIDENCE_REFS. The evidence input is at fault — trim it to the maximum number of allowed references.
Solutions
- Reduce the evidence object to at most MAX_EVIDENCE_REFS keys, keeping only the strongest references
- Split the outcome into multiple recordOutcome calls if more references are genuinely needed
- Check the MAX_EVIDENCE_REFS constant in packages/mastra/src/index.ts for the exact limit
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/mastra/src/index.ts:671 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/f8df5482c0b82f39.
Report an issue: GitHub.
Appendix: source
Thrown at packages/mastra/src/index.ts:671
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]");
}
if (typeof input.source !== "string" || !OUTCOME_SOURCES.has(input.source)) {
throw new Error("recordOutcome: source is required and must be one of ci|environment|database|business_event|human");
}
const occurredAt = input.occurredAt === undefined ? new Date() : new Date(input.occurredAt);
if (Number.isNaN(occurredAt.getTime())) {
throw new Error("recordOutcome: occurredAt must be a valid date");
}
const body = JSON.stringify({
correlation_kind: "task",
correlation_id: taskId,View on GitHub (pinned to 766dce6b13)