Skip to main content
This page documents error codes you may encounter when using Enclave, along with their causes and solutions.

Execution Errors

VALIDATION_ERROR

Cause: Code failed AST validation. A blocked construct was used. Example:
Solution:
  • Review the AgentScript language definition
  • Remove blocked constructs from your code
  • Check the validation issues for specific lines

TIMEOUT

Cause: Execution exceeded the configured timeout. Example:
Solutions:
  1. Optimize slow tool calls
  2. Reduce iteration count
  3. Increase timeout (if appropriate)

MAX_TOOL_CALLS

Cause: Script made too many tool calls. Example:
Solutions:
  1. Batch operations in tools instead of individual calls
  2. Increase maxToolCalls limit
  3. Review script logic for unnecessary calls

MAX_ITERATIONS

Cause: Loop iterations exceeded the limit. Example:
Solutions:
  1. Use pagination or limits in data fetching
  2. Process data in chunks
  3. Increase maxIterations (carefully)

TOOL_ERROR

Cause: A tool handler threw an error. Example:
Solutions:
  1. Check tool inputs are valid
  2. Handle errors in tool handlers gracefully
  3. Provide meaningful error messages

MEMORY_LIMIT_EXCEEDED

Cause: Script used more memory than allowed. Example:
Solutions:
  1. Process large data in chunks
  2. Use Reference Sidecar for large tool responses
  3. Increase memory limit

SCORING_BLOCKED

Cause: AI Scoring Gate detected suspicious patterns. Example:
Solutions:
  1. Review code for exfiltration patterns
  2. Avoid list→send sequences
  3. Use specific queries instead of wildcards
  4. Adjust scoring thresholds if false positive

Validation Issues

Unknown global

Message: Unknown global 'xyz' - not in allowed list Cause: Code references an identifier not in the allowed globals list. Solution: Add to allowedGlobals or use a tool instead:

Blocked identifier

Message: Identifier 'process' is not allowed Cause: Code uses a blocked identifier like process, eval, etc. Solution: Remove the blocked identifier or use an allowed alternative.

Invalid loop type

Message: 'while' loops are not allowed Cause: Code uses a blocked loop type. Solution: Use for or for-of instead:

User-defined function

Message: User-defined functions are not allowed Cause: Code declares a function. Solution: Use arrow functions in array methods or inline logic:

Pre-Scanner Errors

Input size exceeded

Message: Input size 150KB exceeds limit 100KB Solution: Reduce code size or adjust pre-scanner limits.

Nesting depth exceeded

Message: Nesting depth 25 exceeds limit 20 Solution: Simplify nested expressions.

Potential ReDoS pattern

Message: Regex pattern '(a+)+' may cause ReDoS Solution: Remove or simplify the regex pattern.

Connection Errors

Connection refused

Cause: Cannot connect to broker or runtime. Solutions:
  1. Check the server is running
  2. Verify the URL is correct
  3. Check network/firewall settings

Session not found

Cause: Referencing an expired or invalid session. Solutions:
  1. Sessions expire after completion
  2. Create a new session
  3. Check session ID is correct

Debugging Tips

Enable verbose errors

Log validation results

Track execution stats