{"record":{"id":"b741447426ac7605","repo":"paperclipai/paperclip","slug":"managed-sandbox-environment-changed-during-reactiv","errorCode":null,"errorMessage":"Managed sandbox environment changed during reactivation","messagePattern":"Managed sandbox environment changed during reactivation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/environments.ts","lineNumber":575,"sourceCode":"            typeof rowArchiveToken === \"string\" &&\n            matchingBindings.some((binding) => {\n              const bindingDefaults = binding.defaultsJson;\n              return bindingDefaults.status === \"archived\" &&\n                bindingDefaults[MANAGED_ENVIRONMENT_ARCHIVE_TOKEN_DEFAULTS_KEY] === rowArchiveToken;\n            });\n          if (archivedByReconciler) {\n            const reactivated = await tx\n              .update(environments)\n              .set({\n                status: \"active\",\n                metadata: withoutManagedEnvironmentArchiveToken(row.metadata),\n                updatedAt: new Date(),\n              })\n              .where(and(eq(environments.id, row.id), eq(environments.status, \"archived\")))\n              .returning()\n              .then((rows) => rows[0] ?? null);\n            if (!reactivated) {\n              throw new Error(\"Managed sandbox environment changed during reactivation\");\n            }\n            row = reactivated;\n            providerReactivated = true;\n\n            for (const binding of matchingBindings) {\n              const reactivatedDefaults = {\n                ...managedEnvironmentBaselineDefaults(binding.defaultsJson),\n                status: \"active\",\n              };\n              const reactivatedHash = stockHash(reactivatedDefaults);\n              await tx\n                .update(builtInManagedResources)\n                .set({\n                  stockHash: reactivatedHash,\n                  defaultsJson: reactivatedDefaults,\n                  updatedAt: new Date(),\n                })\n                .where(and(","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/environments.ts#L557-L593","documentation":"Concurrency guard in ensureManagedSandboxEnvironment's reactivation path: the row this transaction was about to reactivate changed underneath it (archive token no longer matches), indicating a concurrent reconciler touched it. Aborts rather than overwriting the other writer's state.","triggerScenarios":"Thrown at server/src/services/environments.ts:575 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the reactivation; the environment changed concurrently. Investigate concurrent modifications if it persists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}