ssssssss-team/spider-flow · error · NoSuchMethodException

functionName

Error message

functionName

What it means

Sentinel error raised by ScriptManager.eval when the expression invokes a function name that has not been registered in the ScriptManager's function registry (the functions list guarded by containsFunction). The input at fault is functionName — the identifier used in the spider-flow expression does not correspond to any function defined via @Function or otherwise registered, so lookup fails with a ScriptException naming the missing function.

Solutions

  1. Verify the function name in the expression matches a registered function (check @Function annotations and package scanning of function classes).
  2. Register the missing function with ScriptManager before executing the flow.
  3. Correct typos or wrong-case function names in the expression template.
  4. Call ScriptManager.containsFunction(functionName) before eval to pre-check availability.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at spider-flow-core/src/main/java/org/spiderflow/core/script/ScriptManager.java:108 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ssssssss-team/spider-flow@c799cca99c (2026-09-08). Data as JSON: /api/errors/a60c8cfec581704a. Report an issue: GitHub.

Appendix: source

Thrown at spider-flow-core/src/main/java/org/spiderflow/core/script/ScriptManager.java:108

        } finally {
            lock.readLock().unlock();
        }
    }

    public static void validScript(String functionName,String parameters,String script) throws Exception {
        new ScriptEngineManager().getEngineByName("nashorn").eval(concatScript(functionName,parameters,script));
    }

    public static Object eval(ExpressionTemplateContext context, String functionName, Object ... args) throws ScriptException, NoSuchMethodException {
        if("_eval".equals(functionName)){
            if(args == null || args.length != 1){
                throw new ScriptException("_eval必须要有一个参数");
            }else{
                return ExpressionTemplate.create(args[0].toString()).render(context);
            }
        }
        if(scriptEngine == null){
            throw new NoSuchMethodException(functionName);
        }
        try{
            lock.readLock().lock();
            return convertObject(((Invocable) scriptEngine).invokeFunction(functionName, args));
        } finally{
            lock.readLock().unlock();
        }
    }

    private static Object convertObject(Object object){
        if(object instanceof ScriptObjectMirror){
            ScriptObjectMirror mirror = (ScriptObjectMirror) object;
            if(mirror.isArray()){
                int size = mirror.size();
                Object[] array = new Object[size];
                for (int i = 0; i < size; i++) {
                    array[i] = convertObject(mirror.getSlot(i));
                }

View on GitHub (pinned to c799cca99c)