{"record":{"id":"d21d76baec4a9c16","repo":"Tencent/WeKnora","slug":"sandbox-read-session-binding-w","errorCode":null,"errorMessage":"sandbox: read session binding: %w","messagePattern":"sandbox: read session binding: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_manager.go","lineNumber":897,"sourceCode":"}\n\n// lookupSessionHandle reads the authoritative binding and, when one exists\n// with the current provider, connects to the remote sandbox without\n// allocating. Used by artifact / staging paths that must never provision.\nfunc (m *SessionBoundManager) lookupSessionHandle(\n\tctx context.Context,\n\tsessionID string,\n) (RemoteSandboxHandle, bool, error) {\n\tif m.remoteDisabled() || strings.TrimSpace(sessionID) == \"\" {\n\t\treturn nil, false, nil\n\t}\n\tkey, err := m.sessionKey(ctx, sessionID)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tbinding, err := m.bindings.Get(ctx, key)\n\tif err != nil {\n\t\treturn nil, false, fmt.Errorf(\"sandbox: read session binding: %w\", err)\n\t}\n\tif binding == nil || binding.Provider != m.client.Provider() {\n\t\treturn nil, false, nil\n\t}\n\thandle, err := m.client.Connect(ctx, binding.SandboxID)\n\tif err != nil {\n\t\tif CanReplaceRemoteBinding(err) {\n\t\t\treturn nil, false, nil\n\t\t}\n\t\treturn nil, false, fmt.Errorf(\"sandbox: connect session sandbox: %w\", err)\n\t}\n\tif handle == nil || handle.ID() != binding.SandboxID ||\n\t\thandle.Provider() != m.client.Provider() {\n\t\treturn nil, false, errors.New(\"sandbox: remote handle does not match binding\")\n\t}\n\treturn handle, true, nil\n}\n","sourceCodeStart":879,"sourceCodeEnd":915,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_manager.go#L879-L915","documentation":"Wrapping error in lookupSessionHandle when the session-to-sandbox binding store (m.bindings.Get) returns an error. Artifact and staging paths use this lookup to connect without provisioning, so a binding-store outage (storage/backend failure) fails the read-path operation with the store's error wrapped.","triggerScenarios":"Thrown at internal/sandbox/session_manager.go:897 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the health of the binding store backing m.bindings","Retry the lookup on transient store errors","Distinguish store failures from the nil-binding (no binding) case, which is not an error"],"exampleFix":null,"handlingStrategy":"try-catch","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"}