TencentCloud/TencentDB-Agent-Memory · error · MetadataError
invalid_param_value
invalid_param_value
Error message
param ${module}.${paramName} value '${str}' is not a valid integer What it means
getEffectiveInt resolves a config parameter to its effective string value and then parses it as an integer with parseInt. When the resolved value cannot be parsed as an integer (parseInt returns NaN), the service throws this invalid_param_value MetadataError. This guards numeric parameters like maxUsers and maxTeams from receiving non-numeric stored values.
Source
Thrown at MemoryCore/src/metadata/service/config-param-service.ts:140
const cached = this.getCached(cacheKey);
if (cached !== undefined) return cached;
const userRow = await this.store.getConfigParam("user", userId, module, paramName);
if (userRow) {
this.setCache(cacheKey, userRow.param_value);
return userRow.param_value;
}
const globalValue = await this.getGlobalValue(module, paramName, paramDef);
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)) {View on GitHub (pinned to 3efcd317b8)
Solutions
- Check the stored/effective value of the parameter (global default or user override) and correct it to a valid integer string, e.g. '100'.
- Re-seed the parameter definition so it has a sane numeric default instead of an empty/placeholder value.
- If the value may legitimately be non-numeric, use getEffectiveParam instead and parse/validate it yourself.
- Wrap the call in try-catch on MetadataError with code 'invalid_param_value' and fall back to a numeric default.
Example fix
// before
const max = await configService.getEffectiveInt("memory", "maxItems");
// after — validate/fallback
let max = 100;
try {
max = await configService.getEffectiveInt("memory", "maxItems");
} catch (e) {
if ((e as MetadataError).code !== "invalid_param_value") throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
const raw = await svc.getEffectiveParam(module, paramName, userId);
if (raw === "" || !Number.isInteger(parseInt(raw, 10))) throw new Error(`expected integer for ${module}.${paramName}, got '${raw}'`); Type guard
function isIntString(s: string): boolean {
return /^-?\d+$/.test(s.trim());
} Try / catch
try {
max = await svc.getEffectiveInt(module, paramName, userId);
} catch (e) {
if (e instanceof MetadataError && e.code === "invalid_param_value") {
max = 100; // sensible default
} else throw e;
} Prevention
- Seed every integer param with a valid numeric default in the registry.
- Validate stored values at write time so non-numeric values never enter the store.
- Prefer getEffectiveParam plus your own parsing when values may be unset.
- Monitor for invalid_param_value in logs to catch corrupted config data early.
When it happens
Trigger: Calling getEffectiveInt (directly or via maxUsers/maxTeams helpers) for a parameter whose effective string value is empty, non-numeric (e.g. 'abc', 'true'), or contains a non-numeric prefix such that parseInt yields NaN.
Common situations: A config parameter was seeded or overridden in the store with a typo'd value ('10oo'), a placeholder ('unset'), or an empty string; or a caller stored a numeric param via setUserParam with an invalid literal that was never validated.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- redis config is required when state_backend=redis
- memory 系统用户 key 必须匹配 sk-mem-[A-Za-z0-9_-]{32}
- llm.provider=proxy 且 useMemorySystemUserKey=false 时必须显式 llm.
- Generation log object key exceeds COS limit
- Invalid generation log key
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/bf56423d1fb4251d.
Report an issue: GitHub.