Scripts not permitted to use method CI/CD Origin: Build & delivery Last updated 25 Oct 2026

Jenkins: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String toUpperCase

A sandboxed Pipeline script called a method that has not been approved in Script Security.

Exact message you may see Scripts not permitted to use methodScripts not permitted to use newScripts not permitted to use staticMethod
Seen on: Jenkins

Meaning

Pipeline scripts run in a Groovy sandbox for safety. Unapproved methods are blocked until an administrator approves the signature at Manage Jenkins → In-process Script Approval. Safer fix: move the logic into a shared library (trusted) or use built-in steps.

Common causes

  • Using Java/Groovy APIs not whitelisted in the sandbox
  • Calling methods on arbitrary objects (e.g. new File())
  • New signature after a plugin update
  • Script uses @NonCPS or reflection
  • Shared library marked untrusted

⚡ Quick fix

  1. Approve the signature in Manage Jenkins → In-process Script Approval (review it first)
  2. Move logic into a trusted shared library
  3. Replace with pipeline steps (readJSON, sh)

Detailed fix by platform

Jenkins

  1. Use readJSON/writeFile steps instead of Java IO
  2. Review requests carefully — approval grants that call to all sandboxed scripts

How to diagnose

  1. Method — Which signature is rejected?
  2. Alternative — Is a Pipeline step available?
  3. Trust — Safe to approve?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

ComparisonError: manifest generation failed — Argo CD: ComparisonError: rpc error: code = Unknown desc = Manifest generation error (cached): kustomize build failed (CI/CD)ComparisonError: mani…Could not find credentials entry — Jenkins: ERROR: Could not find credentials entry with ID 'github-token' (CI/CD)Could not find creden…No such DSL method — Jenkins: java.lang.NoSuchMethodError: No such DSL method 'dockerBuild' found among steps (CI/CD)No such DSL methodpermission denied /var/run/docker.sock — Jenkins: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock (CI/CD)permission denied /va…Template file not found — Azure Pipelines: /azure-pipelines.yml: File /templates/build.yml not found in repository / Unable to find template (CI/CD)Template file not fou…Waiting for next available executor — Jenkins: Still waiting to schedule task — Waiting for next available executor / 'agent1' is offline (CI/CD)Waiting for next avai…WorkflowScript compilation error — Jenkins: WorkflowScript: 12: unexpected token: } @ line 12, column 5. 1 error (CI/CD)WorkflowScript compil…Scripts n…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.