paperclipai/paperclip · error

Failed to ensure managed sandbox environment: environment "$

Error message

Failed to ensure managed sandbox environment: environment "${input.name}" already exists with driver "${nameOwner.driver}"

What it means

Name-conflict guard in ensureManagedSandboxEnvironment: the desired managed sandbox name already belongs to an environment with a non-sandbox driver. The instance can have only one Paperclip-managed sandbox environment, and it cannot steal a name owned by another driver kind.

Source

Thrown at server/src/services/environments.ts:430

            ],
            set: {
              resourceId: environmentId,
              stockVersion,
              stockHash: installedStockHash,
              defaultsJson,
              updatedAt: new Date(),
            },
          });
        };

        if (!row) {
          const nameOwner = await tx
            .select()
            .from(environments)
            .where(eq(environments.name, input.name))
            .then((rows) => rows[0] ?? null);
          if (nameOwner && nameOwner.driver !== "sandbox") {
            throw new Error(
              `Failed to ensure managed sandbox environment: environment "${input.name}" already exists with driver "${nameOwner.driver}"`,
            );
          }
          const now = new Date();
          const inserted = await tx
            .insert(environments)
            .values({
              name: input.name,
              description: input.description ?? null,
              driver: "sandbox",
              status: "active",
              config: desiredConfig,
              envVars: {},
              metadata: mergeManagedEnvironmentMetadata(null, desiredMetadata, keys),
              createdAt: now,
              updatedAt: now,
            })
            // Either the managed-slot partial index or the global name index

View on GitHub (pinned to 01ad858492)

Solutions

  1. Use a different environment name, or delete/rename the existing environment that owns the name.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/environments.ts:430 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18). Data as JSON: /api/errors/a9a28f2db4964ba9. Report an issue: GitHub.