Resolving "Cannot Create a Workspace" Error When Accessing External State

Last updated: November 10, 2024

Issue: Error Accessing External State

Error Message: "Cannot create a workspace"

This error usually occurs when trying to access external state in Spacelift. Below are the common causes and additional methods to facilitate external state access.

Common Causes and Solutions

  1. Consuming Stack Is Not Set as Administrative
    To access external state, the consuming stack must have administrative privileges. Verify that the stack attempting to access the state is marked as administrative in Spacelift’s settings.

  2. Stack being consumed does not have external state access enabled

    Ensure that the stack being has external state access enabled, this is under the vendor settings in stack settings.

  3. Accessing State from a Different Space
    If a stack in a child space is trying to access the state of a stack in a parent or different space, this can trigger the error. Ensure the consuming stack is either in the same space as the state provider or in a parent space to enable proper access.

Alternative Solution: Using Stack Dependencies

Spacelift's stack dependencies enables you to share outputs between stacks regardless of their space locations. This method allows stacks to access each other’s outputs based on dependency configuration.

Important Notes about Stack Dependencies:

  • Tracked Runs Only: Stack dependencies only work with tracked runs. Proposed runs and tasks are not considered.

  • Permissions Required: To create a dependency, you must have at least reader permission on the dependency stack and admin permission on the depender stack.

For more details, see Spaces Access Control.

Additional Resources