Tencent/APIJSON · error · UnsupportedOperationException
不允许调用远程函数 " + fb.getMethod() + " !
Error message
不允许调用远程函数 " + fb.getMethod() + " !
What it means
Before executing a remote function, the parser looks up the method name in FUNCTION_MAP, which is loaded from the backend Function table. If no row exists for that method, it throws UnsupportedOperationException — the function is not registered server-side and therefore not callable. (Note the FIXME in source: lookup currently ignores schema, so schema-qualified names are not distinguished.)
Source
Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractFunctionParser.java:412
* @param parser
* @param function 例如get(Map:map,key),参数只允许引用,不能直接传值
* @param current
* @return {@link #invoke(AbstractFunctionParser, String, Class[], Object[])}
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public static <T, M extends Map<String, Object>, L extends List<Object>> Object invoke(
@NotNull AbstractFunctionParser<T, M, L> parser, @NotNull String function
, @NotNull Map<String, Object> current, boolean containRaw) throws Exception {
if (ENABLE_REMOTE_FUNCTION == false) {
throw new UnsupportedOperationException("AbstractFunctionParser.ENABLE_REMOTE_FUNCTION" +
" == false 时不支持远程函数!如需支持则设置 AbstractFunctionParser.ENABLE_REMOTE_FUNCTION = true !");
}
FunctionBean fb = parseFunction(function, current, false, containRaw);
Map<String, Object> row = FUNCTION_MAP.get(fb.getMethod()); //FIXME fb.getSchema() + "." + fb.getMethod()
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 + " !");
}View on GitHub (pinned to 5284052872)
Solutions
- Insert/register the function in the backend Function table (method, language, returnType, etc.).
- Verify the exact method name spelling in the request matches the table row.
- Restart or re-trigger FUNCTION_MAP loading after adding rows, since the map is cached.
- If you meant a purely client-side expression, replace it with plain operators/columns instead of a function call.
Example fix
-- before: Function table empty for myFunc
INSERT INTO sys.Function (name, language, returnType, arguments, demo) VALUES ('myFunc', 'java', 'Number', 'key', 'myFunc(id)');
-- then restart so FUNCTION_MAP reloads Defensive patterns
Strategy: validation
Validate before calling
if (AbstractFunctionParser.FUNCTION_MAP.get(methodName) == null) {
// function not registered: fail fast client-side or register it in the Function table
} Type guard
public static boolean isRegisteredFunction(String name) {
return AbstractFunctionParser.FUNCTION_MAP != null && AbstractFunctionParser.FUNCTION_MAP.get(name) != null;
} Try / catch
try { parser.invoke(fn, current); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("不允许调用远程函数")) { /* log missing registration, check Function table */ } throw e; } Prevention
- Seed the Function table via versioned SQL migrations so every environment has the rows.
- After inserting rows, restart/reload so FUNCTION_MAP refreshes.
- Add a smoke test after deploy that invokes one registered function.
When it happens
Trigger: Request invokes function "myFunc(...)", but the Function table has no row with that method name; or the Function table failed to load (test/demo DB missing the apijson Function rows).
Common situations: Function rows never inserted into the Function table in a new environment; method name typo between client and table; FUNCTION_MAP loaded once at startup so later DB inserts require a reload/restart.
Related errors
- 字符 " + function + " 不合法!
- AbstractFunctionParser.ENABLE_REMOTE_FUNCTION == false 时不支持远
- language = " + language + " 不合法!AbstractFunctionParser.ENABL
- 找不到脚本语言 " + lang + " 对应的执行引擎!请先依赖相关库并在后端 APIJSONFunctionPars
- 不允许 version = " + parser.getVersion() + " 的请求调用远程函数 " + fb.g
AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14).
Data as JSON: /api/errors/505acbdb5d166010.
Report an issue: GitHub.