TencentCloud/TencentDB-Agent-Memory · error · ParamRegistryError

Module '${mod.module}': each param must have a 'param_name'

Error message

Module '${mod.module}': each param must have a 'param_name' string

What it means

Each param object inside a module must have a 'param_name' that is a non-empty string. buildRegistry throws this when param.param_name is missing, empty, or not a string. Parameter names are the registry's lookup keys, so they must be well-formed before anything else is validated.

Source

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

        `Invalid module name '${mod.module}': must match ${MODULE_RE}`,
      );
    }
    if (seenModules.has(mod.module)) {
      throw new ParamRegistryError(`Duplicate module '${mod.module}'`);
    }
    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`,

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Add a string param_name to every param object in the module
  2. Fix misspelled keys so the field is exactly param_name
  3. Quote numeric/identifier values so param_name is a JSON string
  4. Run a pre-load lint that asserts typeof p.param_name === 'string' for all params

Example fix

// before
{ "param_value": 10, "description": "..." }
// after
{ "param_name": "max_entries", "param_value": 10, "description": "..." }
Defensive patterns

Strategy: validation

Validate before calling

for (const m of data.modules) {
  for (const p of m.params ?? []) {
    if (typeof p.param_name !== 'string' || p.param_name === '') {
      throw new Error(`param in ${m.module} missing string param_name`);
    }
  }
}

Type guard

function hasParamName(p) {
  return typeof p?.param_name === 'string' && p.param_name.length > 0;
}

Try / catch

try {
  const registry = await loadParamRegistry();
} catch (e) {
  if (e instanceof ParamRegistryError && e.message.includes("must have a 'param_name' string")) {
    console.error('Add a string param_name to each param in the named module');
  } else throw e;
}

Prevention

When it happens

Trigger: A param object in data.modules[i].params lacks param_name, has param_name: "", or param_name of a non-string type (number, object, etc.) during loadParamRegistry.

Common situations: Hand-authored JSON with the key misspelled ("name" instead of "param_name"); numeric IDs pasted without quotes; deserialized data where a field got renamed upstream.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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