{"record":{"id":"1a10ca8c9c6271a8","repo":"Tencent/WeKnora","slug":"sandbox-remote-sandbox-has-no-template-configured","errorCode":null,"errorMessage":"sandbox: remote sandbox has no template configured","messagePattern":"sandbox: remote sandbox has no template configured","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"internal/sandbox/remote_sandbox.go","lineNumber":82,"sourceCode":"\treturn s.client.Health(ctx) == nil\n}\n\n// Cleanup is a no-op: RemoteSandbox holds no long-lived state. Session\n// cleanup lives in SessionBoundManager, which owns the authoritative binding.\nfunc (s *RemoteSandbox) Cleanup(context.Context) error { return nil }\n\n// Execute allocates a fresh sandbox, runs cfg's script, and always tears the\n// sandbox down. It is the ephemeral path used when a caller provides no\n// SessionID.\nfunc (s *RemoteSandbox) Execute(ctx context.Context, cfg *ExecuteConfig) (*ExecuteResult, error) {\n\tif s == nil || s.client == nil {\n\t\treturn nil, ErrSandboxDisabled\n\t}\n\tif cfg == nil {\n\t\treturn nil, ErrInvalidScript\n\t}\n\tif s.createRequest.TemplateID == \"\" {\n\t\treturn nil, errors.New(\"sandbox: remote sandbox has no template configured\")\n\t}\n\n\texecCtx, cancel := boundedExecuteContext(ctx, cfg)\n\tdefer cancel()\n\n\thandle, err := s.client.Create(execCtx, s.createRequest)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"remote sandbox: create: %w\", err)\n\t}\n\tdefer s.disposeEphemeral(ctx, handle)\n\n\treturn s.ExecuteOnHandle(execCtx, handle, cfg)\n}\n\n// ExecuteOnHandle runs cfg's script against an existing handle without\n// allocating or deleting the underlying sandbox. It is the persistent path\n// SessionBoundManager drives after resolving the session's handle.\nfunc (s *RemoteSandbox) ExecuteOnHandle(","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/remote_sandbox.go#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the template ID in the create request when constructing the remote sandbox (sandbox creation options)","Verify the config source that supplies the template ID is loaded and non-empty for the current environment","Recreate the sandbox with a valid template rather than trying to Execute on the misconfigured instance"],"exampleFix":"// before\nsb, _ := sandbox.NewRemoteSandbox(client, sandbox.CreateRequest{})\n// after\nsb, _ := sandbox.NewRemoteSandbox(client, sandbox.CreateRequest{TemplateID: \"base-image-v3\"})","handlingStrategy":"validation","validationCode":"if req.TemplateID == \"\" {\n    return errors.New(\"remote sandbox requires a template before Execute\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require a template ID parameter in sandbox factory functions (don't default to empty)","Validate create requests at construction time, not at Execute time","Keep template IDs in environment config with startup checks for presence"],"tags":["go","sandbox","e2b","template","config"],"backgroundTag":"missing-configuration","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}