Tencent/APIJSON · error · UnsupportedOperationException

不允许 version = " + parser.getVersion() + " 的请求调用远程函数 " + fb.g

Error message

不允许 version = " + parser.getVersion() + " 的请求调用远程函数 " + fb.getMethod() + " ! 必须满足 version >= " + version + " !

What it means

Function rows carry a minimum-version field; the parser compares parser.getVersion() (usually derived from the request's @version or parser default) against it and throws UnsupportedOperationException when the request version is lower. This lets operators stage breaking function changes behind a version gate.

Source

Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractFunctionParser.java:429

		if (row == null) {
			throw new UnsupportedOperationException("不允许调用远程函数 " + fb.getMethod() + " !");
		}

        String language = (String) row.get("language");
        String lang = "java".equalsIgnoreCase(language) ? null : language;

        if (ENABLE_SCRIPT_FUNCTION == false && lang != null) {
            throw new UnsupportedOperationException("language = " + language + " 不合法!AbstractFunctionParser.ENABLE_SCRIPT_FUNCTION" +
                    " == false 时不支持远程函数中的脚本形式!如需支持则设置 AbstractFunctionParser.ENABLE_SCRIPT_FUNCTION = true !");
        }

		if (lang != null && SCRIPT_EXECUTOR_MAP.get(lang) == null) {
			throw new ClassNotFoundException("找不到脚本语言 " + lang + " 对应的执行引擎!请先依赖相关库并在后端 APIJSONFunctionParser<T, M, L> 中注册!");
		}

		int version = row.get("version") != null ? Integer.parseInt(row.get("version").toString()) : 0;
		if (parser.getVersion() < version) {
			throw new UnsupportedOperationException("不允许 version = " + parser.getVersion() + " 的请求调用远程函数 " + fb.getMethod() + " ! 必须满足 version >= " + version + " !");
		}
		String tag = (String) row.get("tag");  // TODO 改为 tags,类似 methods 支持多个 tag。或者干脆不要?因为目前非开放请求全都只能后端指定
		if (tag != null && tag.equals(parser.getTag()) == false) {
			throw new UnsupportedOperationException("不允许 tag = " + parser.getTag() + " 的请求调用远程函数 " + fb.getMethod() + " ! 必须满足 tag = " + tag + " !");
		}
		String[] methods = StringUtil.split((String) row.get("methods"));
		List<String> ml = methods == null || methods.length <= 0 ? null : Arrays.asList(methods);
		if (ml != null && ml.contains(parser.getMethod().toString()) == false) {
			throw new UnsupportedOperationException("不允许 method = " + parser.getMethod() + " 的请求调用远程函数 " + fb.getMethod() + " ! 必须满足 method 在 " + Arrays.toString(methods) + "内 !");
		}

		try {
            return invoke(parser, fb.getMethod(), fb.getTypes(), fb.getValues(), (String) row.get("returnType"), current, SCRIPT_EXECUTOR_MAP.get(lang));
		}
        catch (Exception e) {
			if (e instanceof NoSuchMethodException) {
				throw new IllegalArgumentException("字符 " + function + " 对应的远程函数 " + getFunction(fb.getMethod(), fb.getKeys())
                        + " 不在后端 " + parser.getClass().getName() + " 内,也不在父类中!如果需要则先新增对应方法!"

View on GitHub (pinned to 5284052872)

Solutions

  1. Send a higher version in the request (e.g. add "@version": 3) or set the parser's default version accordingly.
  2. Or lower/reset the version column of that Function row if all clients should use it.
  3. Keep client @version in sync with the Function table's minimum versions as part of release notes.

Example fix

// before
{"User":{"@column":"maskPhone(phone)"}} // parser version < row version

// after
{"@version":3, "User":{"@column":"maskPhone(phone)"}}
Defensive patterns

Strategy: validation

Validate before calling

int rowMinVersion = row.get("version") != null ? Integer.parseInt(row.get("version").toString()) : 0;
if (parser.getVersion() < rowMinVersion) {
    // bump request @version or lower the row's version requirement
}

Try / catch

try { parser.invoke(fn, current); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("version")) { /* retry with raised @version */ } throw e; }

Prevention

When it happens

Trigger: Function table row sets version=3 while the request/parser runs with version < 3 (e.g. request lacks @version so the parser default, often 1 or 0, applies).

Common situations: A function was upgraded and its row's version bumped, but existing clients still send the old default version; new environment imported Function rows with version values but clients never set @version.

Related errors


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