{"record":{"id":"349389cb37de62db","repo":"theonedev/onedev","slug":"behavior-rejected-interface-invocation","errorCode":null,"errorMessage":"Behavior rejected interface invocation. ","messagePattern":"Behavior rejected interface invocation\\. ","errorType":"exception","errorClass":"org.apache.wicket.authorization.UnauthorizedListenerInvocationException$ListenerInvocationNotAllowedException","httpStatus":null,"severity":"warning","filePath":"server-core/src/main/java/org/apache/wicket/RequestListenerInterface.java","lineNumber":247,"sourceCode":"\t * \n\t * @param rcomponent\n\t *            The component\n\t * @param behavior\n\t * @throws ListenerInvocationNotAllowedException\n\t *             when listener invocation attempted on a component that does not allow it\n\t */\n\tpublic final void invoke(final IRequestableComponent rcomponent, final Behavior behavior)\n\t{\n\t\t// we are in Wicket core land\n\t\tfinal Component component = (Component)rcomponent;\n\n\t\tHierarchicalContext.push(new HierarchicalContext(new ComponentHierarchical(component)));\n\t\ttry {\n\t\t\tif (!behavior.canCallListenerInterface(component, method))\n\t\t\t{\n\t\t\t\tlog.warn(\"behavior not enabled; ignore call. Behavior {} at component {}\", behavior,\n\t\t\t\t\tcomponent);\n\t\t\t\tthrow new ListenerInvocationNotAllowedException(this, component, behavior,\n\t\t\t\t\t\"Behavior rejected interface invocation. \");\n\t\t\t}\n\t\n\t\t\tinternalInvoke(component, behavior);\n\t\t} finally {\n\t\t\tHierarchicalContext.pop();\n\t\t}\n\t}\n\n\tprivate void internalInvoke(final Component component, final Object target)\n\t{\n\t\t// save a reference to the page because the component can be removed\n\t\t// during the invocation of the listener and thus lose its parent\n\t\tPage page = component.getPage();\n\n\t\t// initialization is required for stateless pages\n\t\tif (!page.isInitialized())\n\t\t{","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/RequestListenerInterface.java#L229-L265","documentation":"Same guard as the component-level check, but applied to a Behavior attached to the component: behavior.canCallListenerInterface() returned false, usually because the behavior is temporarily disabled (isEnabled()) or its state no longer permits the call. Wicket logs a warning and re-renders the page instead of invoking the behavior's listener.","triggerScenarios":"An AjaxRequestBehavior/AbstractAjaxTimerBehavior or similar is disabled via behavior.setEnabled(false) or removed between render and the incoming callback; the behavior was added conditionally in onConfigure and the condition changed.","commonSituations":"Toggling behaviors dynamically (e.g. disabling auto-update behavior on some pages); state changes between page render and the Ajax round-trip; adding behaviors in onBeforeRender that don't get re-added identically on subsequent requests.","solutions":["Verify the behavior's isEnabled(component)/isStateless logic returns the same answer at render and request time","If disabling intentionally, expect and accept the silent fail; remove client-side triggers too","Ensure behaviors are added unconditionally (e.g. in onInitialize) when their listeners must always be callable","Check that getStatelessHint and component reuse produce identical behavior attachment per request"],"exampleFix":"// before\nbehavior.setEnabled(false); // old Ajax call now rejected\n// after\nif (behavior.isEnabled(component)) {\n    // safe to invoke / render trigger\n}","handlingStrategy":"validation","validationCode":"boolean callable = behavior.isEnabled(component) && component.isVisibleInHierarchy();","typeGuard":null,"tryCatchPattern":"try {\n    processAjaxRequest();\n} catch (ListenerInvocationNotAllowedException e) {\n    log.debug(\"Behavior callback rejected: {}\", e.getMessage());\n}","preventionTips":["Add behaviors unconditionally in onInitialize when their listeners must always respond","Keep isEnabled/isStateless logic stable between render and request","Avoid removing behaviors mid-session for components with live client-side triggers"],"tags":["wicket","behavior","stale-request"],"backgroundTag":"invalid-state-transition","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}