{"record":{"id":"3f83559ae249a029","repo":"Tencent/APIJSON","slug":"refuse-value-rfs-key-3f8355","errorCode":null,"errorMessage":"REFUSE:value 中出现了重复的 {rfs} ！不允许重复，也不允许一个 key 和取反 !key 同时使用！","messagePattern":"REFUSE:value 中出现了重复的 (.+?) ！不允许重复，也不允许一个 key 和取反 !key 同时使用！","errorType":"validation","errorClass":"ConflictException","httpStatus":409,"severity":"error","filePath":"APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java","lineNumber":1092,"sourceCode":"\t\t\t\t\t\tfor (String key : rkset) {\n\t\t\t\t\t\t\tif (key == null || key.startsWith(\"@\") || notRefuseSet.contains(key)\n                                    || mustSet.contains(key) || objKeySet.contains(key)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// 支持id ref: id{}@\n\t\t\t\t\t\t\tif (key.endsWith(\"@\") && mustSet.contains(key.substring(0, key.length() - 1))) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trefuseSet.add(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {  // 排除 !key 后再禁传其它的\n\t\t\t\t\t\tnotRefuseSet.add(rfs);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (refuseSet.contains(rfs)) {\n\t\t\t\t\t\tthrow new ConflictException(REFUSE.name() + \":value 中出现了重复的 \" + rfs + \" ！\" +\n                                \"不允许重复，也不允许一个 key 和取反 !key 同时使用！\");\n\t\t\t\t\t}\n\t\t\t\t\tif (notRefuseSet.contains(rfs)) {\n\t\t\t\t\t\tthrow new ConflictException(REFUSE.name() + \":value 中同时出现了 \" + rfs + \" 和 !\" + rfs + \" ！\" +\n                                \"不允许重复，也不允许一个 key 和取反 !key 同时使用！\");\n\t\t\t\t\t}\n\n\t\t\t\t\trefuseSet.add(rfs);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 解析不允许的字段>>>>>>>>>>>>>>>>>>>\n\n\t\tSet<String> onKeys = new LinkedHashSet<>();\n\n\t\t// 判断不允许传的key<<<<<<<<<<<<<<<<<<<<<<<<<\n\t\tfor (String rk : rkset) {","sourceCodeStart":1074,"sourceCodeEnd":1110,"githubUrl":"https://github.com/Tencent/APIJSON/blob/5284052872898eddc449a58f629e5c8d588b8e22/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java#L1074-L1110","documentation":"Thrown while parsing the Request-table REFUSE list: a plain (non-negated) key appears more than once. Duplicate refuse entries indicate a configuration mistake.","triggerScenarios":"REFUSE=\"name,password,name\" — the second 'name' hits refuseSet.contains(rfs).","commonSituations":"Concatenating refuse lists without dedup; adding a key that was already listed during later edits; generating the list from overlapping role rules.","solutions":["Deduplicate the REFUSE value","Generate REFUSE from a Set/unique collection in your config tooling","Add a startup lint that validates Request-table REFUSE/MUST values for duplicates"],"exampleFix":"-- before\nREFUSE=\"name,password,name\"\n-- after\nREFUSE=\"name,password\"","handlingStrategy":"validation","validationCode":"function lintRefuse(refuse) {\n  const seen = new Set();\n  for (let k of refuse.split(',')) {\n    k = k.trim(); if (!k) continue;\n    if (seen.has(k)) throw new Error(`duplicate REFUSE entry: ${k}`);\n    seen.add(k);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate REFUSE from unique collections","Diff Request-table configs in code review to catch copy-paste duplicates"],"tags":["apijson","config","request-table","refuse"],"backgroundTag":null,"analyzedSha":"5284052872898eddc449a58f629e5c8d588b8e22","analyzedAt":"2026-08-14T15:15:29.577Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}