Tencent/APIJSON · error · ConflictException

REFUSE:value 中出现了重复的 {rfs} !不允许重复,也不允许一个 key 和取反 !key 同时使用!

Error message

REFUSE:value 中出现了重复的 {rfs} !不允许重复,也不允许一个 key 和取反 !key 同时使用!

What it means

Thrown while parsing the Request-table REFUSE list: a plain (non-negated) key appears more than once. Duplicate refuse entries indicate a configuration mistake.

Source

Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java:1092

						for (String key : rkset) {
							if (key == null || key.startsWith("@") || notRefuseSet.contains(key)
                                    || mustSet.contains(key) || objKeySet.contains(key)) {
								continue;
							}
							// 支持id ref: id{}@
							if (key.endsWith("@") && mustSet.contains(key.substring(0, key.length() - 1))) {
								continue;
							}
							refuseSet.add(key);
						}
					}
					else {  // 排除 !key 后再禁传其它的
						notRefuseSet.add(rfs);
					}
				}
				else {
					if (refuseSet.contains(rfs)) {
						throw new ConflictException(REFUSE.name() + ":value 中出现了重复的 " + rfs + " !" +
                                "不允许重复,也不允许一个 key 和取反 !key 同时使用!");
					}
					if (notRefuseSet.contains(rfs)) {
						throw new ConflictException(REFUSE.name() + ":value 中同时出现了 " + rfs + " 和 !" + rfs + " !" +
                                "不允许重复,也不允许一个 key 和取反 !key 同时使用!");
					}

					refuseSet.add(rfs);
				}
			}
		}

		// 解析不允许的字段>>>>>>>>>>>>>>>>>>>

		Set<String> onKeys = new LinkedHashSet<>();

		// 判断不允许传的key<<<<<<<<<<<<<<<<<<<<<<<<<
		for (String rk : rkset) {

View on GitHub (pinned to 5284052872)

Solutions

  1. Deduplicate the REFUSE value
  2. Generate REFUSE from a Set/unique collection in your config tooling
  3. Add a startup lint that validates Request-table REFUSE/MUST values for duplicates

Example fix

-- before
REFUSE="name,password,name"
-- after
REFUSE="name,password"
Defensive patterns

Strategy: validation

Validate before calling

function lintRefuse(refuse) {
  const seen = new Set();
  for (let k of refuse.split(',')) {
    k = k.trim(); if (!k) continue;
    if (seen.has(k)) throw new Error(`duplicate REFUSE entry: ${k}`);
    seen.add(k);
  }
}

Prevention

When it happens

Trigger: REFUSE="name,password,name" — the second 'name' hits refuseSet.contains(rfs).

Common situations: Concatenating refuse lists without dedup; adding a key that was already listed during later edits; generating the list from overlapping role rules.

Related errors


AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14). Data as JSON: /api/errors/3f83559ae249a029. Report an issue: GitHub.