mastra-ai/mastra · error · Error
Subconscious curationCadence must be a positive integer.
Error message
Subconscious curationCadence must be a positive integer.
What it means
config.curationCadence controls how often (in observed turns) the curation phase runs; when provided it must be a positive integer. Zero, negatives, floats, or non-numbers throw at construction. Omitting it keeps the built-in default cadence.
Source
Thrown at packages/memory/src/processors/observational-memory/subconscious/index.ts:136
if (!Number.isInteger(pins.maxPins) || pins.maxPins < 1) {
throw new Error('Subconscious pins.maxPins must be a positive integer.');
}
if (
!Number.isInteger(pins.maxCharacters) ||
pins.maxCharacters < 1 ||
pins.maxCharacters > MAX_PINNED_MAX_CHARACTERS
) {
throw new Error(
`Subconscious pins.maxCharacters must be an integer between 1 and ${MAX_PINNED_MAX_CHARACTERS}.`,
);
}
}
if (
config.curationCadence !== undefined &&
(!Number.isInteger(config.curationCadence) || config.curationCadence < 1)
) {
throw new Error('Subconscious curationCadence must be a positive integer.');
}
this.config = Object.freeze({ ...config, observation: [...observation], reflection: [...reflection] });
this.resolved = Object.freeze({
observation: observation.map(entry =>
entryName(entry) === 'remind'
? resolveAgent(entry, BUILT_IN_OBSERVATION, config.model, maxSteps)
: resolveExtractor(entry),
),
reflection: reflection.map(entry => resolveAgent(entry, BUILT_IN_REFLECTION, config.model, maxSteps)),
defaultScope: config.defaultScope ?? 'resource',
maxScope: config.maxScope,
learnedGuidance: config.learnedGuidance !== false,
tools: config.tools !== false,
activity: recentUpdates === false ? false : { recentUpdates },
pins,
curationCadence: config.curationCadence,
});View on GitHub (pinned to 75dd419e61)
Solutions
- Set curationCadence to a positive integer; use 1 for every-turn curation.
- Omit curationCadence to use the default cadence.
- Coerce env/JSON values with Number() and validate Number.isInteger(n) && n >= 1 before constructing.
Example fix
// before
new Subconscious({ curationCadence: 0 })
// after
new Subconscious({ curationCadence: 1 }) Defensive patterns
Strategy: validation
Validate before calling
if (config.curationCadence !== undefined && (!Number.isInteger(config.curationCadence) || config.curationCadence < 1)) {
throw new Error('curationCadence must be a positive integer');
} Type guard
function isValidCadence(v: unknown): v is number {
return Number.isInteger(v) && (v as number) >= 1;
} Try / catch
try {
const sub = new Subconscious(config);
} catch (err) {
if (err.message.includes('curationCadence')) {
throw new ConfigError('Set curationCadence to a positive integer (1 = every turn), or omit for default');
} else throw err;
} Prevention
- Use 1 (not 0) for curation on every observed turn.
- Parse env/JSON values with Number() and check Number.isInteger.
- Cover cadence parsing in a unit test when loading config from external sources.
When it happens
Trigger: Configuring curationCadence: 0 (e.g. intending 'every turn'), a negative value, a float, or a string like "5" from parsed env/JSON config.
Common situations: Setting 0 expecting curation on every observation instead of using 1; unparsed env values; arithmetic producing NaN (NaN fails Number.isInteger).
Related errors
- Subconscious semantic knowledge requires a vector store. Pas
- Subconscious semantic knowledge requires an embedder. Pass a
- Subconscious ${phase} agent name is required.
- Duplicate Subconscious ${phase} agent: ${name}
- Subconscious maxSteps must be an integer between 1 and ${MAX
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/446d55f8aa77bf08.
Report an issue: GitHub.