Tencent/APIJSON · error · IllegalArgumentException

后端 Request 表中 ALLOW_PARTIAL_UPDATE_FAIL:value 中 {key} 对应的 {k

Error message

后端 Request 表中 ALLOW_PARTIAL_UPDATE_FAIL:value 中 {key} 对应的 {key}:[] 不存在!

What it means

Each token in ALLOW_PARTIAL_UPDATE_FAIL must not only end with '[]' but also refer to an existing array key in the same Request-table structure object (target.get(key) must be a Collection). This error fires when the config lists e.g. 'User[]' but the structure has no 'User[]':[] entry at all, so there is nothing for partial-failure to apply to — a config inconsistency, not a client mistake.

Source

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

			Map<String,Object> map = new HashMap<>();
			for (String u : uniques) {
				map.put(u, real.get(u));
			}
			verifyRepeat(name, map, exceptId, finalIdKey, parser);
		}
		// 校验重复>>>>>>>>>>>>>>>>>>>

		// 校验并配置允许批量增删改部分失败<<<<<<<<<<<<<<<<<<<
		String allowPartialUpdateFail = StringUtil.get(getString(target, ALLOW_PARTIAL_UPDATE_FAIL.name()));
		String[] partialFails = StringUtil.split(allowPartialUpdateFail);
		if (partialFails != null && partialFails.length > 0) {
			for (String key : partialFails) {
                if (isArrayKey(key) == false) {
                    throw new IllegalArgumentException("后端 Request 表中 " + ALLOW_PARTIAL_UPDATE_FAIL.name()
                            + ":value 中 " + key + " 不合法!必须以 [] 结尾!");
                }
                if (target.get(key) instanceof Collection == false) {
                    throw new IllegalArgumentException("后端 Request 表中 " + ALLOW_PARTIAL_UPDATE_FAIL.name()
                            + ":value 中 " + key + " 对应的 " + key + ":[] 不存在!");
                }

                // 可能 Table[] 和 Table:alias[] 冲突  int index = key.indexOf(":");
                // String k = index < 0 ? key.substring(0, key.length() - 2) : key.substring(0, index);
                String k = key.substring(0, key.length() - 2);
                if (k.isEmpty()) {
                    throw new IllegalArgumentException("后端 Request 表中 " + ALLOW_PARTIAL_UPDATE_FAIL.name()
                            + ":value 中 " + key + " 不合法![] 前必须有名字!");
                }

				AbstractSQLConfig.ALLOW_PARTIAL_UPDATE_FAIL_TABLE_MAP.putIfAbsent(k, "");
			}
		}
		// 校验并配置允许部分批量增删改失败>>>>>>>>>>>>>>>>>>>


		String[] nks = ifObj == null ? null : StringUtil.split(getString(real, KEY_NULL));

View on GitHub (pinned to 5284052872)

Solutions

  1. Add the matching array key to the structure, e.g. include "User[]":[] in the same Request object, or
  2. Remove the stale token from ALLOW_PARTIAL_UPDATE_FAIL so the list only contains keys that exist as arrays in that structure.
  3. Check exact spelling/case: keys are case-sensitive, 'user[]' will not match 'User[]'.

Example fix

// before
{"ALLOW_PARTIAL_UPDATE_FAIL":"Comment[]","Moment[]":[]}
// after
{"ALLOW_PARTIAL_UPDATE_FAIL":"Moment[]","Moment[]":[]}
Defensive patterns

Strategy: validation

Validate before calling

void checkPartialFailTargets(JSONObject structure) {
  String[] toks = StringUtil.split(StringUtil.get(structure.getString("ALLOW_PARTIAL_UPDATE_FAIL")));
  if (toks == null) return;
  for (String t : toks)
    if (!(structure.get(t) instanceof Collection))
      throw new IllegalStateException(t + " listed in ALLOW_PARTIAL_UPDATE_FAIL but " + t + ":[] missing in structure");
}

Try / catch

try { verifier.parse(...); }
catch (IllegalArgumentException e) {
  if (e.getMessage() != null && e.getMessage().contains(":[] 不存在")) {
    // reconcile structure vs allow-list, then re-deploy
  }
  throw e;
}

Prevention

When it happens

Trigger: Request table structure contains ALLOW_PARTIAL_UPDATE_FAIL:"Comment[]" while the same object has no "Comment":[] / "Comment[]":[] key (target.get("Comment[]") is null or not a Collection). The exception is thrown during AbstractVerifier.parse of that structure on the next matching request.

Common situations: Renaming a table in the structure but forgetting to update ALLOW_PARTIAL_UPDATE_FAIL; hand-merging two Request rows; deleting a batch key from structure but leaving its name in ALLOW_PARTIAL_UPDATE_FAIL; typo in the table name inside the allow-list.

Related errors


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