Resolving "panic: simple: adding self edge" Error During Run Preparation

Last updated: December 19, 2025

If you encounter a panic error with the message "simple: adding self edge" during the prepare phase of a run, this indicates a circular dependency in your environment variables. The worker crashes when trying to expand environment variables that reference themselves or create a circular reference loop.

What Causes This Error

This error occurs when environment variables contain circular references, such as:

  • A variable that references itself: FOO=${FOO}

  • Two or more variables that reference each other: A=${B} and B=${A}

  • A chain of variables that eventually loops back to the original variable

How to Fix the Issue

To resolve this error, follow these steps:

  1. Review all environment variables in your stack, including those inherited from Contexts or Spaces. You can find these under the Environment tab in your stack configuration.

  2. Look for variables with interpolation syntax that use ${...}, particularly those that might reference themselves or other variables in a circular manner.

  3. Identify and fix circular references by either:

    • Making one of the values literal (removing the ${...} syntax)

    • Escaping the dollar sign as $$ if you need a literal dollar sign

    • Breaking the circular chain by changing the reference structure

  4. Re-run your stack to confirm the error is resolved.

Prevention

To avoid this issue in the future:

  • Be careful when using variable interpolation with ${...} syntax

  • Always ensure that variable references form a directed acyclic graph (no loops)

  • Test changes to environment variables in a development environment first

If you continue to experience issues after checking for circular references, please contact support with your run ID and environment variable configuration.