TencentCloud/TencentDB-Agent-Memory · error · ParamRegistryError

Module '${mod.module}': invalid param_name '${param.param_na

Error message

Module '${mod.module}': invalid param_name '${param.param_name}': must match ${PARAM_NAME_RE}

What it means

Parameter names must match PARAM_NAME_RE. buildRegistry throws this when a param_name is a string but fails the pattern (e.g. contains uppercase, spaces, hyphens, or symbols not permitted). This keeps param identifiers uniform and addressable.

Source

Thrown at MemoryCore/src/metadata/config/param-registry.ts:111

    }
    seenModules.add(mod.module);

    if (!mod.description) {
      throw new ParamRegistryError(`Module '${mod.module}' must have a description`);
    }
    if (!Array.isArray(mod.params) || mod.params.length === 0) {
      throw new ParamRegistryError(`Module '${mod.module}' must have at least one param`);
    }

    const seenParams = new Set<string>();
    for (const param of mod.params) {
      if (!param.param_name || typeof param.param_name !== "string") {
        throw new ParamRegistryError(
          `Module '${mod.module}': each param must have a 'param_name' string`,
        );
      }
      if (!PARAM_NAME_RE.test(param.param_name)) {
        throw new ParamRegistryError(
          `Module '${mod.module}': invalid param_name '${param.param_name}': must match ${PARAM_NAME_RE}`,
        );
      }
      if (seenParams.has(param.param_name)) {
        throw new ParamRegistryError(
          `Module '${mod.module}': duplicate param_name '${param.param_name}'`,
        );
      }
      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`,

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Read PARAM_NAME_RE in param-registry.ts to confirm the exact allowed syntax
  2. Rename the param to match the pattern (typically lowercase snake_case)
  3. Trim surrounding whitespace from the param_name
  4. Enforce the pattern in CI with a script that tests every param_name against the same regex

Example fix

// before
{ "param_name": "max-entries", ... }
// after
{ "param_name": "max_entries", ... }
Defensive patterns

Strategy: validation

Validate before calling

const PARAM_NAME_RE = /^[a-z][a-z0-9_]*$/; // match the library's definition
for (const m of data.modules) {
  for (const p of m.params ?? []) {
    if (typeof p.param_name === 'string' && !PARAM_NAME_RE.test(p.param_name)) {
      throw new Error(`invalid param_name '${p.param_name}' in ${m.module}`);
    }
  }
}

Type guard

function isValidParamName(p) {
  return typeof p?.param_name === 'string' && /^[a-z][a-z0-9_]*$/.test(p.param_name);
}

Try / catch

try {
  const registry = await loadParamRegistry();
} catch (e) {
  if (e instanceof ParamRegistryError && e.message.includes('invalid param_name')) {
    console.error('Rename the param to match PARAM_NAME_RE:', e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: loadParamRegistry validates a param whose param_name string does not pass PARAM_NAME_RE.test, such as 'Max-Entries' or 'max entries'.

Common situations: CamelCase or kebab-case names written where the pattern expects snake_case; whitespace from copy-paste; names copied from a different subsystem with different conventions.

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


AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/af0366b0e0d2ef28. Report an issue: GitHub.