Tencent/WeKnora · error
e2b remote client config is required
Error message
e2b remote client config is required
What it means
newE2BRemoteClient builds the HTTP client used to talk to E2B's envd shim and requires a non-nil *Config; without a config there is no API key, timeout, or endpoint information, so construction fails immediately. This is a constructor-time guard, hit before any network call.
Source
Thrown at internal/sandbox/e2b_remote_client.go:74
// keeps control-plane traffic on the process-wide transport while dialling
// data-plane traffic at the configured gateway (see gateway_transport.go).
// A nil pool falls back to the SDK defaults.
func NewE2BRemoteClientWithPool(
cfg *Config,
pool *SandboxGatewayTransportPool,
) (*E2BRemoteClient, error) {
if pool == nil {
return newE2BRemoteClient(cfg, nil)
}
return newE2BRemoteClient(cfg, pool.RoundTripperFor(cfg))
}
func newE2BRemoteClient(
cfg *Config,
transport http.RoundTripper,
) (*E2BRemoteClient, error) {
if cfg == nil {
return nil, errors.New("e2b remote client config is required")
}
if strings.TrimSpace(cfg.E2BAPIKey) == "" {
return nil, errors.New("E2BAPIKey is required for the E2B backend")
}
timeout := cfg.E2BHTTPTimeout
if timeout <= 0 {
timeout = DefaultE2BHTTPTimeout
}
// Every E2B client speaks to envd through the compatibility shim, whether
// or not a gateway is configured: the two details it rewrites belong to the
// envd protocol itself, not to any one deployment. See envd_compat_transport.go.
httpClient := &http.Client{
Timeout: timeout,
Transport: NewEnvdCompatTransport(transport, DefaultSandboxExecUser),
}
client, err := e2b.NewClient(e2b.ClientConfig{
APIKey: cfg.E2BAPIKey,
APIBaseURL: strings.TrimSpace(cfg.E2BAPIURL),View on GitHub (pinned to 988cbb0330)
Solutions
- Pass a populated *sandbox.Config to NewE2BRemoteClientWithTransport / NewE2BRemoteClientWithPool
- Fix the config loader so it returns a valid Config (or a clear error) instead of nil
- Set E2BAPIKey at the same time — a non-nil config with an empty key fails on the next check
Example fix
// before
client, err := sandbox.NewE2BRemoteClientWithTransport(nil, transport)
// after
cfg := &sandbox.Config{E2BAPIKey: os.Getenv("E2B_API_KEY")}
client, err := sandbox.NewE2BRemoteClientWithTransport(cfg, transport) Defensive patterns
Strategy: validation
Validate before calling
if cfg == nil {
return errors.New("e2b backend: config must be loaded before constructing a client")
} Type guard
func hasE2BConfig(cfg *sandbox.Config) bool { return cfg != nil } Prevention
- Construct backend clients only after a successful config load
- Have factories return explicit errors instead of nil configs
- Cover client construction with a test that passes a real fixture config
When it happens
Trigger: Calling NewE2BRemoteClientWithTransport or NewE2BRemoteClientWithPool with cfg == nil, usually because config assembly produced a nil pointer.
Common situations: Optional E2B config not loaded and nil passed through; a factory function returns nil config on an unhandled branch; tests constructing clients without fixture configs.
Related errors
- sandbox: docker client requires a config
- E2BAPIKey is required for the E2B backend
- sandbox: remote sandbox has no template configured
- sandbox: docker backend requires an image
- E2B timeout must be at least one second
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/fbc72c23edead15d.
Report an issue: GitHub.