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: the negated entry !key appears more than once (duplicate !key). REFUSE supports both refused keys and !key exceptions; duplicates are a config conflict.

Source

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

		Set<String> rkset = real.keySet(); // 解析内容并没有改变rkset

		// 解析不允许的字段<<<<<<<<<<<<<<<<<<<
		String[] refuses = StringUtil.split(refuse);
		Set<String> refuseSet = new HashSet<String>();

		if (refuses != null && refuses.length > 0) {
			Set<String> notRefuseSet = new HashSet<String>();

			for (String rfs : refuses) {
				if (rfs == null) {  // StringUtil.isEmpty(rfs, true) {
					continue;
				}

				if (rfs.startsWith("!")) {
					rfs = rfs.substring(1);

					if (notRefuseSet.contains(rfs)) {
						throw new ConflictException(REFUSE.name() + ":value 中出现了重复的 !"
                                + rfs + " !不允许重复,也不允许一个 key 和取反 !key 同时使用!");
					}
					if (refuseSet.contains(rfs)) {
						throw new ConflictException(REFUSE.name() + ":value 中同时出现了 "
                                + rfs + " 和 !" + rfs + " !不允许重复,也不允许一个 key 和取反 !key 同时使用!");
					}

					if (rfs.equals("")) { // 所有非 MUST
                        // 对@key放行,@role,@column,自定义@position等, @key:{ "Table":{} } 不会解析内部
						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;
							}

View on GitHub (pinned to 5284052872)

Solutions

  1. Deduplicate the REFUSE list so each !key appears once
  2. Build REFUSE programmatically with a Set before saving to the Request table
  3. Re-verify the whole REFUSE value for the related key/!key conflicts after editing

Example fix

-- before
REFUSE="!pictureUrl,name,!pictureUrl"
-- after
REFUSE="!pictureUrl,name"
Defensive patterns

Strategy: validation

Validate before calling

function lintRefuse(refuse /* string or list */) {
  const seen = new Set();
  for (let k of (Array.isArray(refuse) ? refuse : refuse.split(','))) {
    k = k.trim(); if (!k) continue;
    const neg = k.startsWith('!');
    if (seen.has(k)) throw new Error(`duplicate REFUSE entry: ${k}`);
    seen.add(k);
  }
}

Prevention

When it happens

Trigger: Request table REFUSE value contains "!pictureUrl" twice, e.g. REFUSE="!pictureUrl,name,!pictureUrl".

Common situations: Merging REFUSE lists from two configs by concatenation; repeated edits appending the same exception; hand-editing without dedup.

Related errors


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