{"record":{"id":"4326e5d7d8615682","repo":"Tencent/WeKnora","slug":"config-is-nil","errorCode":null,"errorMessage":"config is nil","messagePattern":"config is nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/sandbox.go","lineNumber":367,"sourceCode":"// It deliberately carries no Cube or E2B endpoint, credential or template:\n// those belong to a named workspace config. Presetting them here once meant an\n// incomplete workspace config could silently dial localhost.\nfunc DefaultConfig() *Config {\n\treturn &Config{\n\t\tType:            SandboxTypeDisabled,\n\t\tDefaultTimeout:  DefaultTimeout,\n\t\tDockerImage:     DefaultDockerImage,\n\t\tMaxMemory:       DefaultMemoryLimit,\n\t\tMaxCPU:          DefaultCPULimit,\n\t\tCubeSandboxTTL:  DefaultCubeSandboxTTL,\n\t\tCubeHTTPTimeout: DefaultCubeHTTPTimeout,\n\t}\n}\n\n// ValidateConfig validates sandbox configuration\nfunc ValidateConfig(config *Config) error {\n\tif config == nil {\n\t\treturn errors.New(\"config is nil\")\n\t}\n\n\tswitch config.Type {\n\tcase SandboxTypeDocker, SandboxTypeCube, SandboxTypeE2B, SandboxTypeDisabled:\n\t\t// Valid types\n\tdefault:\n\t\treturn errors.New(\"invalid sandbox type\")\n\t}\n\n\tif config.DefaultTimeout < 0 {\n\t\treturn errors.New(\"timeout cannot be negative\")\n\t}\n\n\tif config.MaxMemory < 0 {\n\t\treturn errors.New(\"memory limit cannot be negative\")\n\t}\n\n\tif config.MaxCPU < 0 {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/sandbox.go#L349-L385","documentation":"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.","triggerScenarios":"Thrown at internal/sandbox/sandbox.go:367 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}