{"record":{"id":"47c2f3c6250504d5","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"module-mod-module-duplicate-param-name-pa","errorCode":null,"errorMessage":"Module '${mod.module}': duplicate param_name '${param.param_name}'","messagePattern":"Module '(.+?)': duplicate param_name '(.+?)'","errorType":"validation","errorClass":"ParamRegistryError","httpStatus":null,"severity":"error","filePath":"MemoryCore/src/metadata/config/param-registry.ts","lineNumber":116,"sourceCode":"    }\n    if (!Array.isArray(mod.params) || mod.params.length === 0) {\n      throw new ParamRegistryError(`Module '${mod.module}' must have at least one param`);\n    }\n\n    const seenParams = new Set<string>();\n    for (const param of mod.params) {\n      if (!param.param_name || typeof param.param_name !== \"string\") {\n        throw new ParamRegistryError(\n          `Module '${mod.module}': each param must have a 'param_name' string`,\n        );\n      }\n      if (!PARAM_NAME_RE.test(param.param_name)) {\n        throw new ParamRegistryError(\n          `Module '${mod.module}': invalid param_name '${param.param_name}': must match ${PARAM_NAME_RE}`,\n        );\n      }\n      if (seenParams.has(param.param_name)) {\n        throw new ParamRegistryError(\n          `Module '${mod.module}': duplicate param_name '${param.param_name}'`,\n        );\n      }\n      seenParams.add(param.param_name);\n\n      if (param.param_value === undefined || param.param_value === null) {\n        throw new ParamRegistryError(\n          `Module '${mod.module}', param '${param.param_name}': param_value is required`,\n        );\n      }\n      if (!param.description) {\n        throw new ParamRegistryError(\n          `Module '${mod.module}', param '${param.param_name}': description is required`,\n        );\n      }\n      if (\n        !Array.isArray(param.allowed_scopes) ||\n        param.allowed_scopes.length === 0","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/MemoryCore/src/metadata/config/param-registry.ts#L98-L134","documentation":"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.","triggerScenarios":"data.modules[i].params contains two entries with the same param_name string, encountered during loadParamRegistry.","commonSituations":"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.","solutions":["Remove the duplicate param entry, keeping the one with the intended value","If both are needed, rename one to a distinct name matching PARAM_NAME_RE","If duplicates span different concerns, split them into separate modules","Add a dedupe check (e.g. jq group-by) to CI for params within each module"],"exampleFix":"// before\n\"params\": [ { \"param_name\": \"max_entries\", \"param_value\": 100 }, { \"param_name\": \"max_entries\", \"param_value\": 500 } ]\n// after\n\"params\": [ { \"param_name\": \"max_entries\", \"param_value\": 500 } ]","handlingStrategy":"validation","validationCode":"for (const m of data.modules) {\n  const names = (m.params ?? []).map(p => p.param_name);\n  const dupes = names.filter((n, i) => names.indexOf(n) !== i);\n  if (dupes.length) throw new Error(`duplicate params in ${m.module}: ${[...new Set(dupes)]}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const registry = await loadParamRegistry();\n} catch (e) {\n  if (e instanceof ParamRegistryError && e.message.includes('duplicate param_name')) {\n    console.error('Remove or rename the duplicated param:', e.message);\n  } else throw e;\n}","preventionTips":["Edit existing param entries instead of duplicating them to change values","Deduplicate params when merging param lists","Add a per-module uniqueness check to CI"],"tags":["configuration","validation","duplicate"],"backgroundTag":"duplicate-key","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}