Tencent/WeKnora · error
config is nil
Error message
config is nil
What it means
Validation guard in ValidateConfig: it fires when the *Config pointer passed to the sandbox subsystem is nil. There is no sensible default to fall back to, so configuration validation fails immediately before any sandbox (Docker, Cube, E2B) is created.
Source
Thrown at internal/sandbox/sandbox.go:367
// It deliberately carries no Cube or E2B endpoint, credential or template:
// those belong to a named workspace config. Presetting them here once meant an
// incomplete workspace config could silently dial localhost.
func DefaultConfig() *Config {
return &Config{
Type: SandboxTypeDisabled,
DefaultTimeout: DefaultTimeout,
DockerImage: DefaultDockerImage,
MaxMemory: DefaultMemoryLimit,
MaxCPU: DefaultCPULimit,
CubeSandboxTTL: DefaultCubeSandboxTTL,
CubeHTTPTimeout: DefaultCubeHTTPTimeout,
}
}
// ValidateConfig validates sandbox configuration
func ValidateConfig(config *Config) error {
if config == nil {
return errors.New("config is nil")
}
switch config.Type {
case SandboxTypeDocker, SandboxTypeCube, SandboxTypeE2B, SandboxTypeDisabled:
// Valid types
default:
return errors.New("invalid sandbox type")
}
if config.DefaultTimeout < 0 {
return errors.New("timeout cannot be negative")
}
if config.MaxMemory < 0 {
return errors.New("memory limit cannot be negative")
}
if config.MaxCPU < 0 {View on GitHub (pinned to 988cbb0330)
Solutions
- Construct a config with DefaultConfig() instead of passing nil
- Ensure the caller that assembles workspace config never stores/passes a nil pointer
- Add an early nil check at the config construction site so the error surfaces closer to the bug
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/sandbox/sandbox.go:367 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/4326e5d7d8615682.
Report an issue: GitHub.