TencentCloud/TencentDB-Agent-Memory · error · ParamRegistryError

Module '${mod.module}': duplicate param_name '${param.param_

Error message

Module '${mod.module}': duplicate param_name '${param.param_name}'

What it means

Within a single module, param_name values must be unique. buildRegistry tracks names in seenParams and throws this error when the same name appears twice in one module. Duplicate names would make the parameter's value ambiguous.

Source

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

    }
    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`,
        );
      }
      if (
        !Array.isArray(param.allowed_scopes) ||
        param.allowed_scopes.length === 0

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Remove the duplicate param entry, keeping the one with the intended value
  2. If both are needed, rename one to a distinct name matching PARAM_NAME_RE
  3. If duplicates span different concerns, split them into separate modules
  4. Add a dedupe check (e.g. jq group-by) to CI for params within each module

Example fix

// before
"params": [ { "param_name": "max_entries", "param_value": 100 }, { "param_name": "max_entries", "param_value": 500 } ]
// after
"params": [ { "param_name": "max_entries", "param_value": 500 } ]
Defensive patterns

Strategy: validation

Validate before calling

for (const m of data.modules) {
  const names = (m.params ?? []).map(p => p.param_name);
  const dupes = names.filter((n, i) => names.indexOf(n) !== i);
  if (dupes.length) throw new Error(`duplicate params in ${m.module}: ${[...new Set(dupes)]}`);
}

Try / catch

try {
  const registry = await loadParamRegistry();
} catch (e) {
  if (e instanceof ParamRegistryError && e.message.includes('duplicate param_name')) {
    console.error('Remove or rename the duplicated param:', e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: data.modules[i].params contains two entries with the same param_name string, encountered during loadParamRegistry.

Common situations: Merging param lists from two sources without deduplication; duplicating a param entry to change its value instead of editing the original; case variations the pattern does not distinguish.

Related errors


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