jenkinsci/jenkins · error · JellyException

Unable to create expression: ${text}

Error message

Unable to create expression: ${text}

What it means

Thrown by ExpressionFactory2.createExpression when the Apache Commons JEXL parser cannot compile the given expression text. Jenkins wraps all JEXL failures (parse errors, security violations) in a JellyException so that view rendering aborts at the point of the bad expression rather than emitting a half-rendered page.

Source

Thrown at core/src/main/java/hudson/ExpressionFactory2.java:31

import org.apache.commons.jexl.JexlContext;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest2;
import org.springframework.security.access.AccessDeniedException;

/**
 * {@link ExpressionFactory} so that security exception aborts the page rendering.
 *
 * @author Kohsuke Kawaguchi
*/
final class ExpressionFactory2 implements ExpressionFactory {
    @Override
    public Expression createExpression(String text) throws JellyException {
        try {
            return new JexlExpression(
                org.apache.commons.jexl.ExpressionFactory.createExpression(text)
            );
        } catch (Exception e) {
            throw new JellyException("Unable to create expression: " + text, e);
        }
    }

    /*
     * Copyright 2002,2004 The Apache Software Foundation.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Open the failing .jelly view and fix the expression syntax reported in the JellyException.
  2. Check the exact expression text echoed in the error message and validate it against JEXL syntax.
  3. If the expression worked before, bisect recent view/property changes.
  4. Run the view in ?safeMode or with JEXL debug logging to isolate the failing token.

Example fix

// before
<j:set var="x" value="${a +}"/>  <!-- syntax error -->
// after
<j:set var="x" value="${a + b}"/>
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
    ExpressionFactory f = ...;
    f.createExpression(text);
} catch (JellyException e) {
    // 'Unable to create expression' — surface to the view author, do not retry blindly
    LOGGER.log(Level.WARNING, "Bad Jelly/JEXL expression: " + text, e);
}

Prevention

When it happens

Trigger: A Jelly/JEXL expression in a .jelly view contains a syntax error; an expression references an undefined namespace or operator; JEXL security policy rejects the expression; expression text is malformed after a refactor of message properties.

Common situations: Editing a .jelly file and breaking ${...} syntax; upgrading a plugin that changed a JEXL helper; typo in an attribute expression; using JEXL features disallowed by the configured JexlSandbox.


AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14). Data as JSON: /api/errors/119059d3d847077b. Report an issue: GitHub.