{"record":{"id":"1a4582d494cebe95","repo":"JuliusBrussee/caveman","slug":"recordoutcome-source-is-required-and-must-be-one","errorCode":null,"errorMessage":"recordOutcome: source is required and must be one of ci|environment|database|business_event|human","messagePattern":"recordOutcome: source is required and must be one of ci\\|environment\\|database\\|business_event\\|human","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mastra/src/index.ts","lineNumber":679,"sourceCode":"      throw new Error(`recordOutcome: evidence.${key} must be a finite number`);\n    }\n    const ref = `${key}:${String(value)}`;\n    if (!ref.slice(key.length + 1)) throw new Error(`recordOutcome: evidence.${key} must be non-empty`);\n    return ref;\n  });\n  if (evidenceRefs.length === 0) {\n    throw new Error(\"recordOutcome: evidence must contain at least one reference\");\n  }\n  if (evidenceRefs.length > MAX_EVIDENCE_REFS) {\n    throw new Error(`recordOutcome: evidence must contain at most ${MAX_EVIDENCE_REFS} references`);\n  }\n\n  const confidence = input.confidence;\n  if (typeof confidence !== \"number\" || !Number.isFinite(confidence) || confidence < 0 || confidence > 1) {\n    throw new Error(\"recordOutcome: confidence is required and must be a number within [0,1]\");\n  }\n  if (typeof input.source !== \"string\" || !OUTCOME_SOURCES.has(input.source)) {\n    throw new Error(\"recordOutcome: source is required and must be one of ci|environment|database|business_event|human\");\n  }\n\n  const occurredAt = input.occurredAt === undefined ? new Date() : new Date(input.occurredAt);\n  if (Number.isNaN(occurredAt.getTime())) {\n    throw new Error(\"recordOutcome: occurredAt must be a valid date\");\n  }\n\n  const body = JSON.stringify({\n    correlation_kind: \"task\",\n    correlation_id: taskId,\n    source: input.source,\n    observed_outcome: `${contract} ${stableStringify(input.values, \"values\")}`,\n    confidence,\n    evidence_refs: evidenceRefs,\n    occurred_at: occurredAt.toISOString(),\n  });\n\n  const doFetch: FetchLike = client.fetch ?? ((url, init) => globalFetch(url, init));","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/mastra/src/index.ts#L661-L697","documentation":"Error \"recordOutcome: source is required and must be one of ci|environment|database|business_event|human\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/mastra/src/index.ts:679 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass source as one of ci, environment, database, business_event, or human."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}