#16183·thingsboard

Script Calculated Field returns MVEL AST object instead of script result (InaccessibleObjectException on sun.reflect.annotation)

Author: Benoit-BeaudoinCreated Sep 23, 2026Updated Sep 24, 2026
Labelsunconfirmed

ThingsBoard edition + version : ThingsBoard Cloud (Professional Edition, managed), Subscription plan: Startup. I don't have access to an exact build number from the tenant UI — could you confirm it from your side? Deployment type : ThingsBoard Cloud, fully managed hosting. No access to backend infrastructure on my end. Java runtime version : Not accessible to me — managed infrastructure on your side. Please check from your platform logs. Full error (from "Test script function" in a Script Calculated Field) : Invalid type definition for type sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl: Failed to construct BeanSerializer for [simple type, class sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl]: (java.lang.IllegalArgumentException) Failed to call setAccess() on Method getType (of class sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl) due to java.lang.reflect.InaccessibleObjectException, problem: Unable to make public final java.lang.reflect.Type sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.getType() accessible: module java.base does not "opens sun.reflect.annotation" to unnamed module @602e0143 (through reference chain: org.mvel2.ast.PrototypalFunctionInstance["function"]->org.mvel2.ast.Function["compiledBlock"]->org.mvel2.compiler.CompiledExpression["firstNode"]->org.mvel2.ast.IndexedAssignmentNode["nextASTNode"]->org.mvel2.ast.EndOfStatement["nextASTNode"]->org.mvel2.ast.DeepAssignmentNode["nextASTNode"]->org.mvel2.ast.EndOfStatement["nextASTNode"]->org.mvel2.ast.ReturnNode["accessor"]->org.mvel2.compiler.ExecutableAccessor["node"]->org.mvel2.ast.ASTNode["literalValue"]->org.mvel2.ParserContext["parserConfiguration"]->org.mvel2.SandboxedParserConfiguration["imports"]->java.util.concurrent.ConcurrentHashMap["parseHexToLong"]->org.mvel2.util.MethodStub["method"]->java.lang.reflect.Method["annotatedReturnType"])

Steps to reproduce:

Create a Script Calculated Field on a Device Profile Add two arguments: one Attribute (e.g., "currentDelay"), one Latest telemetry (e.g., "DI1_status") Script: function calculate(ctx, currentDelay, DI1_status) { return 42; } Click "Test script function" with any sample values Expected output: 42 Actual output: a large JSON object containing function and resolverFactory fields — the compiled AST and MVEL variable resolver state, instead of the script's return value

This also occurs in production (not just in the test dialog): the same corrupted JSON gets written as attributes named function and resolverFactory on real devices when the Calculated Field executes with "Process right away" strategy.