{"record":{"id":"b63f1fda53d454f3","repo":"mastra-ai/mastra","slug":"observation-bufferactivation-must-be-0-got-th","errorCode":null,"errorMessage":"observation.bufferActivation must be > 0, got ${this.observationConfig.bufferActivation}","messagePattern":"observation\\.bufferActivation must be > 0, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/observational-memory.ts","lineNumber":998,"sourceCode":"    }\n\n    // Validate observation bufferTokens\n    const observationThreshold = getMaxThreshold(this.observationConfig.messageTokens);\n    if (this.observationConfig.bufferTokens !== undefined) {\n      if (this.observationConfig.bufferTokens <= 0) {\n        throw new Error(`observation.bufferTokens must be > 0, got ${this.observationConfig.bufferTokens}`);\n      }\n      if (this.observationConfig.bufferTokens >= observationThreshold) {\n        throw new Error(\n          `observation.bufferTokens (${this.observationConfig.bufferTokens}) must be less than messageTokens (${observationThreshold})`,\n        );\n      }\n    }\n\n    // Validate observation bufferActivation: (0, 1] for ratio, or >= 1000 for absolute retention tokens\n    if (this.observationConfig.bufferActivation !== undefined) {\n      if (this.observationConfig.bufferActivation <= 0) {\n        throw new Error(`observation.bufferActivation must be > 0, got ${this.observationConfig.bufferActivation}`);\n      }\n      if (this.observationConfig.bufferActivation > 1 && this.observationConfig.bufferActivation < 1000) {\n        throw new Error(\n          `observation.bufferActivation must be <= 1 (ratio) or >= 1000 (absolute token retention), got ${this.observationConfig.bufferActivation}`,\n        );\n      }\n      if (\n        this.observationConfig.bufferActivation >= 1000 &&\n        this.observationConfig.bufferActivation >= observationThreshold\n      ) {\n        throw new Error(\n          `observation.bufferActivation as absolute retention (${this.observationConfig.bufferActivation}) must be less than messageTokens (${observationThreshold})`,\n        );\n      }\n    }\n\n    // Validate observation blockAfter\n    if (this.observationConfig.blockAfter !== undefined) {","sourceCodeStart":980,"sourceCodeEnd":1016,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/observational-memory.ts#L980-L1016","documentation":"observation.bufferActivation supports two modes: a ratio in (0, 1] of the threshold, or an absolute token count >= 1000. Values in between (0, 1] exclusive — i.e. > 1 but < 1000 — and values <= 0 are ambiguous or meaningless, so the constructor rejects them to prevent silently misinterpreting a ratio as tokens.","triggerScenarios":"new ObservationalMemory({ observation: { bufferActivation: 0 } }) or bufferActivation: -1 (<=0), or bufferActivation: 50 / 500 (any value > 1 and < 1000).","commonSituations":"Entering a percentage like 50 intending '50% of threshold' instead of 0.5; passing 0 to mean 'disabled' instead of omitting the option; copy-pasting a token count from a small config that falls in the dead zone.","solutions":["Use a decimal ratio for proportional activation, e.g. bufferActivation: 0.5.","Use an absolute token count >= 1000, e.g. bufferActivation: 2000.","Remove bufferActivation to use the default activation behavior."],"exampleFix":"// before\nnew ObservationalMemory({ observation: { bufferActivation: 50 } }); // dead zone\n// after\nnew ObservationalMemory({ observation: { bufferActivation: 0.5 } }); // 50% ratio","handlingStrategy":"validation","validationCode":"const ba = observationConfig.bufferActivation;\nif (ba !== undefined && (ba <= 0 || (ba > 1 && ba < 1000))) {\n  throw new Error(`bufferActivation must be <= 1 (ratio) or >= 1000 (absolute), got ${ba}`);\n}","typeGuard":"function isValidBufferActivation(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && (v > 0 && v <= 1 || v >= 1000);\n}","tryCatchPattern":null,"preventionTips":["Express percentages as decimals (0.5), never as 50.","Use 'undefined'/omit the option to disable, not 0.","Add a zod/JSON-schema refinement for the two-mode value range."],"tags":["configuration","validation","observational-memory"],"backgroundTag":"invalid-config-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}