TencentCloud/TencentDB-Agent-Memory · error · ParamRegistryError

Module '${mod.module}' must have at least one param

Error message

Module '${mod.module}' must have at least one param

What it means

A module entry must declare at least one parameter: buildRegistry throws this when mod.params is not an array or is empty. An empty module would be meaningless in the registry, so the library refuses to load it.

Source

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

  for (const mod of data.modules) {
    if (!mod.module || typeof mod.module !== "string") {
      throw new ParamRegistryError("Each module entry must have a 'module' string field");
    }
    if (!MODULE_RE.test(mod.module)) {
      throw new ParamRegistryError(
        `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}'`,
        );

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Add at least one param object to the module's params array
  2. If the module has no params yet, remove the module entry until it does
  3. Fix the field name/key typo if params was accidentally renamed
  4. Validate the registry file with a schema enforcing minItems: 1 on params

Example fix

// before
{ "module": "cache", "description": "...", "params": [] }
// after
{ "module": "cache", "description": "...", "params": [ { "param_name": "max_entries", "param_value": 1000, "description": "Max cache entries", "allowed_scopes": ["global"] } ] }
Defensive patterns

Strategy: validation

Validate before calling

for (const m of data.modules) {
  if (!Array.isArray(m.params) || m.params.length === 0) {
    throw new Error(`module ${m.module} must define at least one param`);
  }
}

Type guard

function hasParams(mod) {
  return Array.isArray(mod.params) && mod.params.length > 0;
}

Try / catch

try {
  const registry = await loadParamRegistry();
} catch (e) {
  if (e instanceof ParamRegistryError && e.message.includes('must have at least one param')) {
    console.error('Add params or remove the empty module entry:', e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: loadParamRegistry sees data.modules[i].params missing, set to null, set to a non-array, or an empty array [].

Common situations: Creating a placeholder module before adding params; a script that strips params during a transform; typos like "param" instead of "params" in the JSON.

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/02396809bb831d35. Report an issue: GitHub.