TencentCloud/TencentDB-Agent-Memory · error · MetadataError
unknown_module
unknown_module
Error message
unknown module: ${module} What it means
setUserParam looks up the module definition in the config registry via getModuleDef before writing a user-scoped parameter. If the module name does not exist in the registry, this unknown_module MetadataError is thrown so writes never target an undefined module.
Source
Thrown at MemoryCore/src/metadata/service/config-param-service.ts:150
this.setCache(cacheKey, globalValue);
return globalValue;
}
async getEffectiveInt(module: string, paramName: string, userId?: string): Promise<number> {
const str = await this.getEffectiveParam(module, paramName, userId);
const num = parseInt(str, 10);
if (Number.isNaN(num)) {
throw new MetadataError("invalid_param_value", `param ${module}.${paramName} value '${str}' is not a valid integer`);
}
return num;
}
// ── 用户写入 ──
async setUserParam(userId: string, module: string, paramName: string, value: string): Promise<ConfigParamEntity> {
const moduleDef = getModuleDef(this.registry, module);
if (!moduleDef) {
throw new MetadataError("unknown_module", `unknown module: ${module}`);
}
const paramDef = getParamDef(this.registry, module, paramName);
if (!paramDef) {
throw new MetadataError("invalid_param_key", `unknown param: ${module}.${paramName}`);
}
if (!isUserWritable(this.registry, module, paramName)) {
throw new MetadataError("invalid_param_scope", `module '${module}' param '${paramName}' is global-only, cannot set for user scope`);
}
this.validateParamValue(moduleDef, paramDef, value);
const result = await this.store.upsertConfigParam({
scope: "user",
user_id: userId,
module,
param_name: paramName,View on GitHub (pinned to 3efcd317b8)
Solutions
- Check the module name spelling against the registry's known module definitions and fix the call site.
- List registered modules (e.g. inspect this.registry / the module registry source) to confirm the exact module identifier.
- If the module was renamed in a version upgrade, migrate config code to the new module name.
- Validate the module name before calling: getModuleDef(registry, module) must return a definition.
Example fix
// before await svc.setUserParam(userId, "memroy", "maxItems", "50"); // after — correct module name await svc.setUserParam(userId, "memory", "maxItems", "50");
Defensive patterns
Strategy: validation
Validate before calling
import { getModuleDef } from "./registry";
if (!getModuleDef(registry, module)) throw new Error(`unknown module: ${module}`);
await svc.setUserParam(userId, module, paramName, value); Try / catch
try {
await svc.setUserParam(userId, module, paramName, value);
} catch (e) {
if (e instanceof MetadataError && e.code === "unknown_module") {
return res.status(400).json({ error: `module '${module}' is not supported` });
}
throw e;
} Prevention
- Keep module names in a shared constants/enum rather than raw strings.
- Validate user-supplied module names against an allowlist at the API boundary.
- Re-check module identifiers after any registry or version upgrade.
- Autocomplete module names in config UIs from the registry, not free text.
When it happens
Trigger: Calling setUserParam(userId, module, paramName, value) with a module string that is not registered (misspelled, renamed, or not loaded into this.registry).
Common situations: Typo in the module name ('memorys' vs 'memory'), a module removed or renamed in a newer version of the registry, or constructing the module name dynamically from untrusted input.
Related errors
- redis config is required when state_backend=redis
- [state-backend] Redis integration is not available — install
- Invalid module name '${mod.module}': must match ${MODULE_RE}
- invalid_param_value
- invalid_param_scope
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/2485486df94e14a7.
Report an issue: GitHub.