{"record":{"id":"9f03c9b6eea9a6e6","repo":"firecrawl/open-lovable","slug":"no-active-sandbox-9f03c9","errorCode":null,"errorMessage":"No active sandbox","messagePattern":"No active sandbox","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/sandbox/providers/vercel-provider.ts","lineNumber":66,"sourceCode":"\n      this.sandboxInfo = {\n        sandboxId,\n        url: sandboxUrl,\n        provider: 'vercel',\n        createdAt: new Date()\n      };\n\n      return this.sandboxInfo;\n\n    } catch (error) {\n      console.error('[VercelProvider] Error creating sandbox:', error);\n      throw error;\n    }\n  }\n\n  async runCommand(command: string): Promise<CommandResult> {\n    if (!this.sandbox) {\n      throw new Error('No active sandbox');\n    }\n\n    \n    try {\n      // Parse command into cmd and args (matching PR syntax)\n      const parts = command.split(' ');\n      const cmd = parts[0];\n      const args = parts.slice(1);\n      \n      // Vercel uses runCommand with cmd and args object (based on PR)\n      const result = await this.sandbox.runCommand({\n        cmd: cmd,\n        args: args,\n        cwd: '/vercel/sandbox',\n        env: {}\n      });\n      \n      // Handle stdout and stderr - they might be functions in Vercel SDK","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/firecrawl/open-lovable/blob/69bd93bae7a9c97ef989eb70aabe6797fb3dac89/lib/sandbox/providers/vercel-provider.ts#L48-L84","documentation":"VercelProvider.runCommand throws 'No active sandbox' when this.sandbox is null. The Vercel Sandbox instance is created in createSandbox(); running any command requires that live instance, so the guard aborts before parsing/executing the command.","triggerScenarios":"runCommand called on a fresh VercelProvider without awaiting createSandbox(); Vercel Sandbox expired (it has a max duration) leaving this.sandbox stale/null; several internal helpers (mkdirResult, writeResult, installResult, setupViteApp paths) hitting the guard when the sandbox died mid-flow.","commonSituations":"Vercel sandbox hit its runtime/time limit during a long build; deploy preview flow constructs the provider but skips createSandbox on a branch; command execution after an earlier step threw and cleanup nulled the sandbox.","solutions":["Await provider.createSandbox() before runCommand","Detect Vercel sandbox expiry and recreate/reconnect before retrying the command","Check VERCEL_TOKEN / team config so createSandbox() actually succeeds","Single-flight createSandbox to avoid concurrent null-sandbox races"],"exampleFix":"// before\nconst provider = new VercelProvider();\nconst r = await provider.runCommand('npm run build');\n// after\nconst provider = new VercelProvider();\nawait provider.createSandbox();\nconst r = await provider.runCommand('npm run build');","handlingStrategy":"validation","validationCode":"if (!provider.sandbox) {\n  await provider.createSandbox();\n}\nconst result = await provider.runCommand(command);","typeGuard":"function sandboxLive(p: VercelProvider): p is VercelProvider & { sandbox: NonNullable<VercelProvider['sandbox']> } {\n  return p.sandbox != null;\n}","tryCatchPattern":"try {\n  await provider.runCommand(cmd);\n} catch (e) {\n  if (e instanceof Error && e.message === 'No active sandbox') {\n    await provider.createSandbox();\n    return provider.runCommand(cmd);\n  }\n  throw e;\n}","preventionTips":["Always await createSandbox() before the first command","Account for Vercel Sandbox max-duration and recreate on expiry","Verify VERCEL_TOKEN/team settings so createSandbox succeeds","Avoid shared provider instances across concurrent requests"],"tags":["sandbox","lifecycle","vercel"],"backgroundTag":"no-active-sandbox","analyzedSha":"69bd93bae7a9c97ef989eb70aabe6797fb3dac89","analyzedAt":"2026-08-28T22:20:32.339Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}