FlowiseAI/Flowise · error · Error

Sandbox Execution Error: ${e}

Error message

Sandbox Execution Error: ${e}

What it means

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.

Source

Thrown at packages/components/src/utils.ts:1729

            if (execution.error) {
                throw new Error(`${execution.error.name}: ${execution.error.value}`)
            }

            if (execution.logs.stderr.length) {
                throw new Error(execution.logs.stderr.join('\n'))
            }

            // Stream output if streaming function provided
            if (streamOutput && output) {
                streamOutput(output)
            }

            // Clean up sandbox
            sbx.kill()

            return parseOutput(output)
        } catch (e) {
            throw new Error(`Sandbox Execution Error: ${e}`)
        }
    } else {
        const builtinDeps = process.env.TOOL_FUNCTION_BUILTIN_DEP
            ? defaultAllowBuiltInDep.concat(process.env.TOOL_FUNCTION_BUILTIN_DEP.split(','))
            : defaultAllowBuiltInDep
        const externalDeps = process.env.TOOL_FUNCTION_EXTERNAL_DEP ? process.env.TOOL_FUNCTION_EXTERNAL_DEP.split(',') : []
        let deps = process.env.ALLOW_BUILTIN_DEP === 'true' ? availableDependencies.concat(externalDeps) : externalDeps
        deps.push(...defaultAllowExternalDependencies)
        deps = [...new Set(deps)]

        // Create secure wrappers for HTTP libraries
        const secureWrappers: ICommonObject = {}

        // Axios
        const secureAxiosWrapper = async (config: any) => {
            return await secureAxiosRequest(config)
        }
        secureAxiosWrapper.get = async (url: string, config: any = {}) => secureAxiosWrapper({ ...config, method: 'GET', url })

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Read the embedded <e> in the message — it usually names the failing operation (provision, install, run).
  2. Verify sandbox env vars (Daytona API key/URL or equivalent) are set and the sandbox service is reachable.
  3. If the failure is npm install, validate the imported package names and that the sandbox can reach the registry.
  4. Ensure the user code returns a JSON-stringifiable value so parseOutput doesn't throw.

Example fix

// before
} catch (e) {
  throw new Error(`Sandbox Execution Error: ${e}`)
}

// after — preserve the original and ensure sbx is cleaned up
} catch (e) {
  try { sbx.kill() } catch {}
  throw new Error(`Sandbox Execution Error: ${e instanceof Error ? e.message : String(e)}`, { cause: e })
}
Defensive patterns

Strategy: try-catch

Validate before calling

function assertSandboxConfigured(env: NodeJS.ProcessEnv) {
  const required = ['SANDBOX_API_KEY', 'SANDBOX_URL'] // adjust to actual names
  const missing = required.filter((k) => !env[k])
  if (missing.length) throw new Error(`Sandbox not configured; missing: ${missing.join(', ')}`)
}

Type guard

function isSandboxProvisionError(e: unknown): boolean {
  return e instanceof Error && /provision|quota|api key|unauthorized/i.test(e.message)
}

Try / catch

} catch (e) {
  try { sbx.kill() } catch {}
  throw new Error(`Sandbox Execution Error: ${e instanceof Error ? e.message : String(e)}`, { cause: e })
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/b935b5d64cd0c152. Report an issue: GitHub.