Tencent/WeKnora · error

sandbox: remote sandbox has no template configured

Error message

sandbox: remote sandbox has no template configured

What it means

RemoteSandbox.Execute refuses to run when the sandbox's pending create request has no TemplateID, because E2B-style remote sandboxes are instantiated from a template; without one, client.Create cannot provision anything. The check happens before any network call so the misconfiguration fails fast with a clear message instead of a provider-side error.

Source

Thrown at internal/sandbox/remote_sandbox.go:82

	return s.client.Health(ctx) == nil
}

// Cleanup is a no-op: RemoteSandbox holds no long-lived state. Session
// cleanup lives in SessionBoundManager, which owns the authoritative binding.
func (s *RemoteSandbox) Cleanup(context.Context) error { return nil }

// Execute allocates a fresh sandbox, runs cfg's script, and always tears the
// sandbox down. It is the ephemeral path used when a caller provides no
// SessionID.
func (s *RemoteSandbox) Execute(ctx context.Context, cfg *ExecuteConfig) (*ExecuteResult, error) {
	if s == nil || s.client == nil {
		return nil, ErrSandboxDisabled
	}
	if cfg == nil {
		return nil, ErrInvalidScript
	}
	if s.createRequest.TemplateID == "" {
		return nil, errors.New("sandbox: remote sandbox has no template configured")
	}

	execCtx, cancel := boundedExecuteContext(ctx, cfg)
	defer cancel()

	handle, err := s.client.Create(execCtx, s.createRequest)
	if err != nil {
		return nil, fmt.Errorf("remote sandbox: create: %w", err)
	}
	defer s.disposeEphemeral(ctx, handle)

	return s.ExecuteOnHandle(execCtx, handle, cfg)
}

// ExecuteOnHandle runs cfg's script against an existing handle without
// allocating or deleting the underlying sandbox. It is the persistent path
// SessionBoundManager drives after resolving the session's handle.
func (s *RemoteSandbox) ExecuteOnHandle(

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Set the template ID in the create request when constructing the remote sandbox (sandbox creation options)
  2. Verify the config source that supplies the template ID is loaded and non-empty for the current environment
  3. Recreate the sandbox with a valid template rather than trying to Execute on the misconfigured instance

Example fix

// before
sb, _ := sandbox.NewRemoteSandbox(client, sandbox.CreateRequest{})
// after
sb, _ := sandbox.NewRemoteSandbox(client, sandbox.CreateRequest{TemplateID: "base-image-v3"})
Defensive patterns

Strategy: validation

Validate before calling

if req.TemplateID == "" {
    return errors.New("remote sandbox requires a template before Execute")
}

Prevention

When it happens

Trigger: Calling Execute (or the exported Execute wrapper) on a remote sandbox whose s.createRequest.TemplateID is empty — i.e. the sandbox was constructed without a template in its create request.

Common situations: Template ID omitted from sandbox factory options; template configured via a config key that was renamed or is empty; environment-specific config (staging/prod) missing the template; tests building RemoteSandbox by hand without a create request template.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/1a10ca8c9c6271a8. Report an issue: GitHub.