{"record":{"id":"2485486df94e14a7","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"unknown-module","errorCode":"unknown_module","errorMessage":"unknown module: ${module}","messagePattern":"unknown module: (.+?)","errorType":"error_code","errorClass":"MetadataError","httpStatus":null,"severity":"error","filePath":"MemoryCore/src/metadata/service/config-param-service.ts","lineNumber":150,"sourceCode":"    this.setCache(cacheKey, globalValue);\n    return globalValue;\n  }\n\n  async getEffectiveInt(module: string, paramName: string, userId?: string): Promise<number> {\n    const str = await this.getEffectiveParam(module, paramName, userId);\n    const num = parseInt(str, 10);\n    if (Number.isNaN(num)) {\n      throw new MetadataError(\"invalid_param_value\", `param ${module}.${paramName} value '${str}' is not a valid integer`);\n    }\n    return num;\n  }\n\n  // ── 用户写入 ──\n\n  async setUserParam(userId: string, module: string, paramName: string, value: string): Promise<ConfigParamEntity> {\n    const moduleDef = getModuleDef(this.registry, module);\n    if (!moduleDef) {\n      throw new MetadataError(\"unknown_module\", `unknown module: ${module}`);\n    }\n\n    const paramDef = getParamDef(this.registry, module, paramName);\n    if (!paramDef) {\n      throw new MetadataError(\"invalid_param_key\", `unknown param: ${module}.${paramName}`);\n    }\n\n    if (!isUserWritable(this.registry, module, paramName)) {\n      throw new MetadataError(\"invalid_param_scope\", `module '${module}' param '${paramName}' is global-only, cannot set for user scope`);\n    }\n\n    this.validateParamValue(moduleDef, paramDef, value);\n\n    const result = await this.store.upsertConfigParam({\n      scope: \"user\",\n      user_id: userId,\n      module,\n      param_name: paramName,","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/MemoryCore/src/metadata/service/config-param-service.ts#L132-L168","documentation":"setUserParam looks up the module definition in the config registry via getModuleDef before writing a user-scoped parameter. If the module name does not exist in the registry, this unknown_module MetadataError is thrown so writes never target an undefined module.","triggerScenarios":"Calling setUserParam(userId, module, paramName, value) with a module string that is not registered (misspelled, renamed, or not loaded into this.registry).","commonSituations":"Typo in the module name ('memorys' vs 'memory'), a module removed or renamed in a newer version of the registry, or constructing the module name dynamically from untrusted input.","solutions":["Check the module name spelling against the registry's known module definitions and fix the call site.","List registered modules (e.g. inspect this.registry / the module registry source) to confirm the exact module identifier.","If the module was renamed in a version upgrade, migrate config code to the new module name.","Validate the module name before calling: getModuleDef(registry, module) must return a definition."],"exampleFix":"// before\nawait svc.setUserParam(userId, \"memroy\", \"maxItems\", \"50\");\n// after — correct module name\nawait svc.setUserParam(userId, \"memory\", \"maxItems\", \"50\");","handlingStrategy":"validation","validationCode":"import { getModuleDef } from \"./registry\";\nif (!getModuleDef(registry, module)) throw new Error(`unknown module: ${module}`);\nawait svc.setUserParam(userId, module, paramName, value);","typeGuard":null,"tryCatchPattern":"try {\n  await svc.setUserParam(userId, module, paramName, value);\n} catch (e) {\n  if (e instanceof MetadataError && e.code === \"unknown_module\") {\n    return res.status(400).json({ error: `module '${module}' is not supported` });\n  }\n  throw e;\n}","preventionTips":["Keep module names in a shared constants/enum rather than raw strings.","Validate user-supplied module names against an allowlist at the API boundary.","Re-check module identifiers after any registry or version upgrade.","Autocomplete module names in config UIs from the registry, not free text."],"tags":["config","unknown-module","registry"],"backgroundTag":"unknown-config-module","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}