{"record":{"id":"59b4808f26744277","repo":"Tencent/WeKnora","slug":"sandbox-build-docker-client-w","errorCode":null,"errorMessage":"sandbox: build Docker client: %w","messagePattern":"sandbox: build Docker client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/manager.go","lineNumber":262,"sourceCode":"\tif dockerImage != \"\" {\n\t\tconfig.DockerImage = dockerImage\n\t}\n\n\tvar client RemoteSandboxClient\n\tvar err error\n\tswitch sType {\n\tcase SandboxTypeCube:\n\t\tif client, err = NewCubeRemoteClient(config); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"sandbox: build Cube client: %w\", err)\n\t\t}\n\tcase SandboxTypeE2B:\n\t\tif client, err = NewE2BRemoteClient(config); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"sandbox: build E2B client: %w\", err)\n\t\t}\n\tcase SandboxTypeDocker:\n\t\tapplyDockerRuntimeDefaults(config)\n\t\tif client, err = NewDockerRemoteClient(config); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"sandbox: build Docker client: %w\", err)\n\t\t}\n\t}\n\tif client == nil {\n\t\treturn NewManager(config)\n\t}\n\treturn NewSessionBoundManager(SessionBoundManagerConfig{\n\t\tConfig:  config,\n\t\tClient:  client,\n\t\tStore:   NewMemorySessionSandboxBindingStore(),\n\t\tChecker: PermissiveSessionExistenceChecker{},\n\t})\n}\n\n// NewDisabledManager creates a manager that rejects all execution requests\nfunc NewDisabledManager() Manager {\n\treturn &DefaultManager{\n\t\tconfig:    DefaultConfig(),\n\t\tsandbox:   &disabledSandbox{},","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/manager.go#L244-L280","documentation":"NewManagerFromType, for the docker backend, applies runtime defaults and builds the client via NewDockerRemoteClient(config); failure is wrapped as \"sandbox: build Docker client: %w\". Construction usually fails when the Docker daemon is unreachable or the configured image/runtime is invalid.","triggerScenarios":"Calling NewManagerFromType(\"docker\", ...) when NewDockerRemoteClient fails — Docker socket not available/unauthorized, DOCKER_HOST misconfigured, or invalid DockerImage/runtime defaults in config.","commonSituations":"Running inside a container without /var/run/docker.sock mounted; Docker Desktop not running locally; missing group permissions on the docker socket; pointing DOCKER_HOST at a remote daemon that is down; specifying an image that the daemon cannot resolve at build time.","solutions":["Verify the Docker daemon is running and reachable (docker info works with the same user/env).","Fix DOCKER_HOST / mount /var/run/docker.sock into containers that need it.","Unwrap the error for the exact client failure (socket permission vs connection refused) and address it.","Validate/override config.DockerImage to an image available to the daemon."],"exampleFix":"// before\nmgr, err := NewManagerFromType(\"docker\", \"myorg/missing-image\") // daemon unreachable\n// after\n// ensure daemon: systemctl start docker; export DOCKER_HOST=unix:///var/run/docker.sock\nmgr, err := NewManagerFromType(\"docker\", \"python:3.11-slim\")","handlingStrategy":"validation","validationCode":"cmd := exec.Command(\"docker\", \"info\")\nif err := cmd.Run(); err != nil {\n    return fmt.Errorf(\"docker daemon unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"mgr, err := NewManagerFromType(\"docker\", image)\nif err != nil {\n    return fmt.Errorf(\"docker client build failed: %w\", err)\n}","preventionTips":["Run docker info as a readiness probe before enabling the docker backend","Mount /var/run/docker.sock or set DOCKER_HOST correctly in containers","Ensure the configured DockerImage exists/pullable from the daemon","Check socket group permissions for the running user"],"tags":["docker","client-construction","daemon"],"backgroundTag":"docker-daemon-unreachable","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}