TencentCloud/TencentDB-Agent-Memory · error · ParamRegistryError
Module '${mod.module}', param '${param.param_name}': allowed
Error message
Module '${mod.module}', param '${param.param_name}': allowed_scopes must be non-empty array What it means
Each param must declare an allowed_scopes array containing at least one scope. buildRegistry throws this when allowed_scopes is missing, not an array, or an empty array. Scopes control where the parameter may be applied (later entries must be 'global' or 'user').
Source
Thrown at MemoryCore/src/metadata/config/param-registry.ts:136
);
}
seenParams.add(param.param_name);
if (param.param_value === undefined || param.param_value === null) {
throw new ParamRegistryError(
`Module '${mod.module}', param '${param.param_name}': param_value is required`,
);
}
if (!param.description) {
throw new ParamRegistryError(
`Module '${mod.module}', param '${param.param_name}': description is required`,
);
}
if (
!Array.isArray(param.allowed_scopes) ||
param.allowed_scopes.length === 0
) {
throw new ParamRegistryError(
`Module '${mod.module}', param '${param.param_name}': allowed_scopes must be non-empty array`,
);
}
for (const scope of param.allowed_scopes) {
if (scope !== "global" && scope !== "user") {
throw new ParamRegistryError(
`Module '${mod.module}', param '${param.param_name}': invalid scope '${scope}'`,
);
}
}
}
registry.set(mod.module, mod);
}
return registry;
}
View on GitHub (pinned to 3efcd317b8)
Solutions
- Set allowed_scopes to an array containing "global", "user", or both
- If the scope value is a string, wrap it: ["global"] instead of "global"
- Choose the correct scope(s) for the param's intended visibility and set them
- Validate with a schema requiring array + minItems: 1 on allowed_scopes before loading
Example fix
// before
{ "param_name": "max_entries", "param_value": 1000, "description": "...", "allowed_scopes": [] }
// after
{ "param_name": "max_entries", "param_value": 1000, "description": "...", "allowed_scopes": ["global"] } Defensive patterns
Strategy: validation
Validate before calling
for (const m of data.modules) {
for (const p of m.params ?? []) {
const s = p.allowed_scopes;
if (!Array.isArray(s) || s.length === 0) {
throw new Error(`${m.module}.${p.param_name} needs a non-empty allowed_scopes array`);
}
if (!s.every(x => x === 'global' || x === 'user')) {
throw new Error(`${m.module}.${p.param_name} has invalid scopes`);
}
}
} Type guard
function hasValidScopes(p) {
return Array.isArray(p?.allowed_scopes) && p.allowed_scopes.length > 0
&& p.allowed_scopes.every(s => s === 'global' || s === 'user');
} Try / catch
try {
const registry = await loadParamRegistry();
} catch (e) {
if (e instanceof ParamRegistryError && e.message.includes('allowed_scopes')) {
console.error('Set allowed_scopes to ["global"], ["user"], or both:', e.message);
} else throw e;
} Prevention
- Always wrap a single scope in an array: ["global"] not "global"
- Decide the scope for each param at authoring time
- Validate allowed_scopes against the enum ['global','user'] in CI
When it happens
Trigger: A param in data.modules[i].params has allowed_scopes absent, set to a non-array (e.g. a string), or set to [] when loadParamRegistry validates it.
Common situations: New params authored before deciding on scoping; a tool serializing a single scope as a bare string instead of an array; an edit that emptied the array.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Module '${mod.module}' must have at least one param
- llm.provider=proxy 且 useMemorySystemUserKey=false 时必须显式 llm.
- teamId is required for an agent prompt setting
- [skill-worker-pool] concurrency must be positive integer, go
- EmbeddingService: dimensions is required for remote provider
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/e0e67d808777de1f.
Report an issue: GitHub.