Tencent/APIJSON · error · IllegalArgumentException

${key}:{} 里的 @combine:value 不合法!开放请求 GET、HEAD 才允许传 @combine:

Error message

${key}:{} 里的 @combine:value 不合法!开放请求 GET、HEAD 才允许传 @combine:value !

What it means

AbstractParser rejects @combine inside a table object whose resolved operation method is not a public method (GET or HEAD). @combine builds OR/AND combinations of conditions and is only exposed for open read requests, so using it with POST/PUT/DELETE-style per-object methods throws IllegalArgumentException.

Source

Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractParser.java:2481

						setRequestAttribute(key, false, KEY_VERSION, request);
						setRequestAttribute(key, false, KEY_ROLE, request);
					}
				}

				if (key.startsWith("@") || key.endsWith("@")) {
					correctRequest.put(key, obj);
					continue;
				}

				if (obj instanceof Map<?, ?> || obj instanceof List<?>) {
					RequestMethod  _method;
					if (obj instanceof Map<?, ?>) {
						Map<String, Object> tblObj = JSON.getMap(request, key);
						String mn = tblObj == null ? null : getString(tblObj, KEY_METHOD);
						_method = mn == null ? null : RequestMethod.valueOf(mn);
						String combine = _method == null ? null : getString(tblObj, KEY_COMBINE);
						if (combine != null && RequestMethod.isPublicMethod(_method) == false) {
							throw new IllegalArgumentException(key + ":{} 里的 @combine:value 不合法!开放请求 GET、HEAD 才允许传 @combine:value !");
						}
					} else {
						Map<String, Object> attrMap = keyObjectAttributesMap.get(key);

						if (attrMap == null) {
							if (method == RequestMethod.CRUD) {
								_method = GET;
								Map<String, Object> objAttrMap = new HashMap<>();
								objAttrMap.put(KEY_METHOD, GET);
								keyObjectAttributesMap.put(key, objAttrMap);
							} else {
								_method = method;
								Map<String, Object> objAttrMap = new HashMap<>();
								objAttrMap.put(KEY_METHOD, method);
								keyObjectAttributesMap.put(key, objAttrMap);
							}
						} else {
							_method = (RequestMethod) attrMap.get(KEY_METHOD);

View on GitHub (pinned to 5284052872)

Solutions

  1. Remove @combine from objects whose method is not GET/HEAD
  2. Or change that object's method to GET: "@method": "GET" if you only meant to read
  3. For complex write conditions use @combine-free operators like key{} / key{}@ directly

Example fix

// before
{"User": {"@method": "PUT", "name~": "a", "sex": 1, "@combine": "name~|sex"}}
// after
{"User": {"@method": "GET", "name~": "a", "sex": 1, "@combine": "name~|sex"}}
Defensive patterns

Strategy: validation

Validate before calling

for (const [tbl, obj] of Object.entries(req)) {
  if (obj && typeof obj === 'object' && '@combine' in obj) {
    const m = (obj['@method'] ?? urlMethod).toUpperCase();
    if (m !== 'GET' && m !== 'HEAD') throw new Error(`@combine not allowed with method ${m} on ${tbl}`);
  }
}

Type guard

const allowsCombine = m => ['GET', 'HEAD'].includes(String(m ?? '').toUpperCase());

Try / catch

try { await client.get(req); } catch (e) { if (e.message.includes('@combine')) deleteCombineAndRetry(req); else throw e; }

Prevention

When it happens

Trigger: A request to /get (or any endpoint) with a table object that declares a non-public method plus @combine, e.g. "User": {"@method": "PUT", "@combine": "name|sex"}; also CRUD endpoint where the object's own method resolves to PUT/POST/DELETE.

Common situations: Copying a GET request template into a write request and leaving @combine in; using the /crud endpoint where each object carries its own @method and trying to combine conditions on a write object.

Related errors


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