{"record":{"id":"b935b5d64cd0c152","repo":"FlowiseAI/Flowise","slug":"sandbox-execution-error-e","errorCode":null,"errorMessage":"Sandbox Execution Error: ${e}","messagePattern":"Sandbox Execution Error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/utils.ts","lineNumber":1729,"sourceCode":"            if (execution.error) {\n                throw new Error(`${execution.error.name}: ${execution.error.value}`)\n            }\n\n            if (execution.logs.stderr.length) {\n                throw new Error(execution.logs.stderr.join('\\n'))\n            }\n\n            // Stream output if streaming function provided\n            if (streamOutput && output) {\n                streamOutput(output)\n            }\n\n            // Clean up sandbox\n            sbx.kill()\n\n            return parseOutput(output)\n        } catch (e) {\n            throw new Error(`Sandbox Execution Error: ${e}`)\n        }\n    } else {\n        const builtinDeps = process.env.TOOL_FUNCTION_BUILTIN_DEP\n            ? defaultAllowBuiltInDep.concat(process.env.TOOL_FUNCTION_BUILTIN_DEP.split(','))\n            : defaultAllowBuiltInDep\n        const externalDeps = process.env.TOOL_FUNCTION_EXTERNAL_DEP ? process.env.TOOL_FUNCTION_EXTERNAL_DEP.split(',') : []\n        let deps = process.env.ALLOW_BUILTIN_DEP === 'true' ? availableDependencies.concat(externalDeps) : externalDeps\n        deps.push(...defaultAllowExternalDependencies)\n        deps = [...new Set(deps)]\n\n        // Create secure wrappers for HTTP libraries\n        const secureWrappers: ICommonObject = {}\n\n        // Axios\n        const secureAxiosWrapper = async (config: any) => {\n            return await secureAxiosRequest(config)\n        }\n        secureAxiosWrapper.get = async (url: string, config: any = {}) => secureAxiosWrapper({ ...config, method: 'GET', url })","sourceCodeStart":1711,"sourceCodeEnd":1747,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/utils.ts#L1711-L1747","documentation":"Outer catch-all wrapping any exception from the Daytona sandbox branch of executeJavascript. It catches errors from sbx creation, npm install, runCode, parseOutput, or sbx.kill — rewrapping them as 'Sandbox Execution Error: <e>'. It hides the original error class.","triggerScenarios":"Daytona sandbox provisioning fails (missing API key, quota exceeded); npm install inside the sandbox fails for an invalid/unreachable package; runCode times out; sbx.kill() throws after an earlier failure; parseOutput throws because the code returned non-stringifiable output.","commonSituations":"SANDBOX_* env vars misconfigured or Daytona API key expired; a custom tool imports a package that doesn't exist on npm; sandbox container quota hit under load; network egress from the sandbox blocked so npm install fails.","solutions":["Read the embedded <e> in the message — it usually names the failing operation (provision, install, run).","Verify sandbox env vars (Daytona API key/URL or equivalent) are set and the sandbox service is reachable.","If the failure is npm install, validate the imported package names and that the sandbox can reach the registry.","Ensure the user code returns a JSON-stringifiable value so parseOutput doesn't throw."],"exampleFix":"// before\n} catch (e) {\n  throw new Error(`Sandbox Execution Error: ${e}`)\n}\n\n// after — preserve the original and ensure sbx is cleaned up\n} catch (e) {\n  try { sbx.kill() } catch {}\n  throw new Error(`Sandbox Execution Error: ${e instanceof Error ? e.message : String(e)}`, { cause: e })\n}","handlingStrategy":"try-catch","validationCode":"function assertSandboxConfigured(env: NodeJS.ProcessEnv) {\n  const required = ['SANDBOX_API_KEY', 'SANDBOX_URL'] // adjust to actual names\n  const missing = required.filter((k) => !env[k])\n  if (missing.length) throw new Error(`Sandbox not configured; missing: ${missing.join(', ')}`)\n}","typeGuard":"function isSandboxProvisionError(e: unknown): boolean {\n  return e instanceof Error && /provision|quota|api key|unauthorized/i.test(e.message)\n}","tryCatchPattern":"} catch (e) {\n  try { sbx.kill() } catch {}\n  throw new Error(`Sandbox Execution Error: ${e instanceof Error ? e.message : String(e)}`, { cause: e })\n}","preventionTips":["Validate sandbox env vars at startup.","Pre-validate imported package names with the same regex used in the sandbox installer.","Ensure user code returns JSON-serializable output so parseOutput can't throw."],"tags":["sandbox","javascript-execution","error-wrapping","daytona"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}