{"record":{"id":"339e65e7cc7b9ed0","repo":"dromara/Sa-Token","slug":"code-12211","errorCode":"CODE_12211","errorMessage":"未找到签名配置，appid={appid}","messagePattern":"未找到签名配置，appid=(.+?)","errorType":"exception","errorClass":"SaSignException","httpStatus":null,"severity":"error","filePath":"sa-token-plugin/sa-token-sign/src/main/java/cn/dev33/satoken/sign/template/SaSignMany.java","lineNumber":55,"sourceCode":"\t\treturn SaSignManager.getSignMany().get(appid);\n\t};\n\n\t/**\n\t * 获取 SaSignTemplate，根据 appid\n\t * @param appid /\n\t * @return /\n\t */\n\tpublic static SaSignTemplate getSignTemplate(String appid) {\n\n\t\t// appid 为空，返回全局默认 SaSignTemplate\n\t\tif(SaFoxUtil.isEmpty(appid)){\n\t\t\treturn SaSignManager.getSaSignTemplate();\n\t\t}\n\n\t\t// 获取 SaSignConfig\n\t\tSaSignConfig config = findSaSignConfigMethod.run(appid);\n\t\tif(config == null){\n\t\t\tthrow new SaSignException(\"未找到签名配置，appid=\" + appid).setCode(SaSignErrorCode.CODE_12211);\n\t\t}\n\n\t\t// 创建 SaSignTemplate 并返回\n\t\treturn new SaSignTemplate(config);\n\t}\n\n}\n","sourceCodeStart":37,"sourceCodeEnd":63,"githubUrl":"https://github.com/dromara/Sa-Token/blob/ac2c7f6e94a78573cf0bcb932dd8b04e68fad189/sa-token-plugin/sa-token-sign/src/main/java/cn/dev33/satoken/sign/template/SaSignMany.java#L37-L63","documentation":"Thrown by SaSignMany.getSignTemplate when a non-empty appid is requested but the configured findSaSignConfigMethod returns no SaSignConfig for it (code 12211). The multi-app signature module resolves per-appid sign configuration through a lookup function you register; a null result means that appid has no signing secret/config on this server.","triggerScenarios":"Calling SaSignMany.getSignTemplate(\"app2\") (or a signed request with appid=app2) when the find-sa-sign-config function only knows app1 — appid not added to the config map/repository.","commonSituations":"New client appid added on the caller but the server-side SaSignMany.setFindSaSignConfigMethod map/DB query was not updated; appid typo or case mismatch (App1 vs app1); config loaded from a table where the row is missing or environment differences between test/prod.","solutions":["Register configuration for the appid: include it in the map/logic behind SaSignMany.setFindSaSignConfigMethod","Verify the appid string matches exactly (case, whitespace) between the request and the configured keys","Check the backing store (DB table / config file) in the failing environment actually contains the appid entry"],"exampleFix":"// before\nSaSignMany.setFindSaSignConfigMethod(appid -> map.get(appid));\n// after\nmap.put(\"app2\", new SaSignConfig().setSecretKey(\"xxx\"));\nSaSignMany.setFindSaSignConfigMethod(appid -> map.get(appid));","handlingStrategy":"validation","validationCode":"if (SaFoxUtil.isNotEmpty(appid) && findSaSignConfigMethod.run(appid) == null) {\n  throw new IllegalStateException(\"no sign config registered for appid: \" + appid);\n}","typeGuard":null,"tryCatchPattern":"try { SaSignMany.getSignTemplate(appid); } catch (SaSignException e) { if (e.getCode() == 12211) return status(401, \"unknown appid\"); throw e; }","preventionTips":["Register all appids before serving traffic and assert the lookup covers every expected caller at startup","Use exact-match appid keys (case-sensitive) and centralize them in config"],"tags":["api-sign","multi-app","configuration","appid"],"backgroundTag":null,"analyzedSha":"ac2c7f6e94a78573cf0bcb932dd8b04e68fad189","analyzedAt":"2026-08-14T14:36:10.271Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}