{"record":{"id":"a60bc8708af15c3d","repo":"Tencent/WeKnora","slug":"get-sandbox-binding-w-a60bc8","errorCode":null,"errorMessage":"get sandbox binding: %w","messagePattern":"get sandbox binding: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_lifecycle.go","lineNumber":519,"sourceCode":"\t\treturn nil\n\t}\n\tcurrent, err := l.readBinding(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif current == nil {\n\t\treturn nil\n\t}\n\treturn errors.New(\"sandbox binding changed during destroy\")\n}\n\nfunc (l *remoteSessionLifecycle) readBinding(\n\tctx context.Context,\n\tkey SessionSandboxKey,\n) (*SessionSandboxBinding, error) {\n\tbinding, err := l.bindings.Get(ctx, key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get sandbox binding: %w\", err)\n\t}\n\tif binding == nil {\n\t\treturn nil, nil\n\t}\n\tif err := binding.Validate(key); err != nil {\n\t\treturn nil, fmt.Errorf(\"validate sandbox binding: %w\", err)\n\t}\n\treturn binding, nil\n}\n\nfunc (l *remoteSessionLifecycle) cleanupCreated(\n\tparent context.Context,\n\thandle RemoteSandboxHandle,\n) error {\n\tif handle == nil || handle.ID() == \"\" {\n\t\treturn errors.New(\"cannot clean up remote sandbox without an ID\")\n\t}\n\treturn l.cleanupSandboxID(parent, handle.ID())","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_lifecycle.go#L501-L537","documentation":"readBinding is the central accessor for the session→sandbox binding record. This error wraps any failure of the underlying bindings.Get call, so all lifecycle paths (resolve, create race resolution, connect-to-winner, destroy) fail with it when the binding store cannot be read.","triggerScenarios":"Any lifecycle call (resolveLocked, createAndBind, connectWinner, destroyBindingLocked) triggers bindings.Get and the store returns an error: network failure, timeout, auth rejection, store unavailability.","commonSituations":"Redis/DB/etcd hosting the bindings is down or unreachable; expired store credentials; context deadline exceeded on a slow store; misconfigured store endpoint.","solutions":["Resolve the wrapped store error (connectivity, auth, timeout)","Retry the operation — most store read failures are transient","Verify store endpoint configuration and credentials","Add health checks/alerting on the binding store to catch outages before session operations"],"exampleFix":"// before\nhandle, err := manager.Resolve(ctx, key)\n// after\nif err != nil {\n    var storeErr error\n    if errors.Is(err, context.DeadlineExceeded) {\n        ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n        defer cancel()\n        handle, err = manager.Resolve(ctx, key)\n    }\n}","handlingStrategy":"retry","validationCode":"ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nif _, err := store.Get(ctx, key); err != nil {\n    // store down — fail fast upstream instead of mid-lifecycle\n}","typeGuard":null,"tryCatchPattern":"handle, err := manager.Resolve(ctx, key)\nif err != nil && (strings.Contains(err.Error(), \"get sandbox binding\") || errors.Is(err, context.DeadlineExceeded)) {\n    // transient store read failure — retry with backoff\n    handle, err = manager.Resolve(ctx, key)\n}","preventionTips":["Run the binding store in HA mode with health probes","Set realistic context deadlines for store reads","Alert on store read error rates"],"tags":["go","binding-store","read","transient"],"backgroundTag":"binding-store-read-failure","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}