Error Reference

Script execution timed out: exceeded maximum allowed time

Script execution timed out: exceeded maximum allowed time

Where this appears

This error appears in the System Log under System Diagnostics > Log > Application Log when server-side scripts exceed the configured transaction quota or script execution timeout. It commonly occurs during business rule execution, scheduled jobs, or background scripts that run too long.

Sourdough
Chrome Extension

Debugging this in a real instance?

Sourdough lets you trace "Script execution timed out: exceeded maximum allowed time" through system logs, script errors, and API health in the ServiceNow tab you are already using.

Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Cause

Large GlideRecord queries without proper limits or inefficient loops processing thousands of records without chunking or yielding control. (high likelihood)

Infinite or deep recursive function calls that consume excessive processing time before the stack limit is reached. (high likelihood)

Synchronous external HTTP calls using RESTMessage or SOAPMessage within business rules that experience network delays or timeouts. (medium likelihood)

Complex database operations or joins on large tables without proper indexing causing query performance issues. (medium likelihood)

System transaction quota set too low for legitimate long-running operations like data imports or bulk updates. (low likelihood)

Fix

Step 1: Navigate to System Diagnostics > Log > Application Log and search for the exact error message to identify the specific script and line number causing the timeout.

Step 2: Review the problematic script code for inefficient GlideRecord operations, checking for missing setLimit() calls or unnecessary loops through large datasets.

Step 3: Examine the script for recursive function calls and add proper exit conditions or convert to iterative approaches where possible.

Step 4: Check for synchronous external API calls and replace with asynchronous patterns using scheduled jobs or event-driven processing instead of real-time execution.

Step 5: Navigate to System Properties and review the glide.script.ccl.time_limit property to understand the current timeout threshold and determine if adjustment is appropriate.

Step 6: For legitimate long-running operations, implement chunking by processing records in smaller batches with scheduled jobs or use gs.sleep() to yield control periodically.

Step 7: Test the modified script in a sub-production environment with representative data volumes to ensure the timeout is resolved without impacting functionality.

Step 8: Monitor the System Log after deployment to confirm the error no longer occurs and performance has improved.

Test Your Knowledge

Quick 3-question quiz. See how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue