{"record":{"id":"af0366b0e0d2ef28","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"module-mod-module-invalid-param-name-para","errorCode":null,"errorMessage":"Module '${mod.module}': invalid param_name '${param.param_name}': must match ${PARAM_NAME_RE}","messagePattern":"Module '(.+?)': invalid param_name '(.+?)': must match (.+?)","errorType":"validation","errorClass":"ParamRegistryError","httpStatus":null,"severity":"error","filePath":"MemoryCore/src/metadata/config/param-registry.ts","lineNumber":111,"sourceCode":"    }\n    seenModules.add(mod.module);\n\n    if (!mod.description) {\n      throw new ParamRegistryError(`Module '${mod.module}' must have a description`);\n    }\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`,","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/MemoryCore/src/metadata/config/param-registry.ts#L93-L129","documentation":"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.","triggerScenarios":"loadParamRegistry validates a param whose param_name string does not pass PARAM_NAME_RE.test, such as 'Max-Entries' or 'max entries'.","commonSituations":"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.","solutions":["Read PARAM_NAME_RE in param-registry.ts to confirm the exact allowed syntax","Rename the param to match the pattern (typically lowercase snake_case)","Trim surrounding whitespace from the param_name","Enforce the pattern in CI with a script that tests every param_name against the same regex"],"exampleFix":"// before\n{ \"param_name\": \"max-entries\", ... }\n// after\n{ \"param_name\": \"max_entries\", ... }","handlingStrategy":"validation","validationCode":"const PARAM_NAME_RE = /^[a-z][a-z0-9_]*$/; // match the library's definition\nfor (const m of data.modules) {\n  for (const p of m.params ?? []) {\n    if (typeof p.param_name === 'string' && !PARAM_NAME_RE.test(p.param_name)) {\n      throw new Error(`invalid param_name '${p.param_name}' in ${m.module}`);\n    }\n  }\n}","typeGuard":"function isValidParamName(p) {\n  return typeof p?.param_name === 'string' && /^[a-z][a-z0-9_]*$/.test(p.param_name);\n}","tryCatchPattern":"try {\n  const registry = await loadParamRegistry();\n} catch (e) {\n  if (e instanceof ParamRegistryError && e.message.includes('invalid param_name')) {\n    console.error('Rename the param to match PARAM_NAME_RE:', e.message);\n  } else throw e;\n}","preventionTips":["Use lowercase snake_case for parameter names","Copy PARAM_NAME_RE into your linter and test names against it","Trim whitespace before saving names"],"tags":["configuration","validation","naming"],"backgroundTag":"schema-validation-failed","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}