{"record":{"id":"59f752e61a39a79d","repo":"Tencent/WeKnora","slug":"get-bound-remote-sandbox-w","errorCode":null,"errorMessage":"get bound remote sandbox: %w","messagePattern":"get bound remote sandbox: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_lifecycle.go","lineNumber":241,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ok {\n\t\treturn recovered, nil\n\t}\n\treturn l.createAndBind(ctx, key)\n}\n\nfunc (l *remoteSessionLifecycle) connectBinding(\n\tctx context.Context,\n\tbinding SessionSandboxBinding,\n) (RemoteSandboxHandle, bool, error) {\n\tsummary, err := l.client.Get(ctx, binding.SandboxID)\n\tif err != nil {\n\t\tif CanReplaceRemoteBinding(err) {\n\t\t\treturn nil, true, nil\n\t\t}\n\t\treturn nil, false, fmt.Errorf(\"get bound remote sandbox: %w\", err)\n\t}\n\tif summary == nil {\n\t\treturn nil, false, errors.New(\"remote sandbox Get returned nil summary\")\n\t}\n\tif summary.ID != binding.SandboxID {\n\t\treturn nil, false, fmt.Errorf(\n\t\t\t\"remote sandbox Get returned ID %q for binding %q\",\n\t\t\tsummary.ID,\n\t\t\tbinding.SandboxID,\n\t\t)\n\t}\n\tif summary.State == RemoteStateTerminal {\n\t\treturn nil, true, nil\n\t}\n\n\thandle, err := l.client.Connect(ctx, binding.SandboxID)\n\tif err != nil {\n\t\tif CanReplaceRemoteBinding(err) {","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_lifecycle.go#L223-L259","documentation":"This error wraps a failure from the remote provider's Get call made while resolving an existing sandbox binding. When a session already has a binding record pointing at a sandbox ID, the lifecycle calls client.Get to verify the sandbox still exists and is healthy; if Get fails with an error that is not recognized as replaceable (e.g. not a definitive 'sandbox gone' signal), the resolution is aborted with 'get bound remote sandbox: %w'. It means the library could not confirm the state of the bound sandbox, so it refuses to guess.","triggerScenarios":"client.Get(ctx, binding.SandboxID) returns a non-nil error that CanReplaceRemoteBinding(err) classifies as false — e.g. transient network failures, authentication/authorization errors, provider 5xx responses, rate limiting, or ambiguous not-found responses the replaceable-detection heuristic does not recognize.","commonSituations":"Network partition or DNS failure while resuming a session; expired or rotated API credentials; provider API outage or throttling; provider SDK returning not-found in a form CanReplaceRemoteBinding does not classify as replaceable; sandbox region/provider configuration changed between runs.","solutions":["Inspect the wrapped error (%w) to identify the root cause — network, auth, or provider API error","Verify provider credentials and network connectivity, then retry the session resolution","If the sandbox truly no longer exists but is not detected as replaceable, delete the stale binding record so resolution proceeds to recovery/creation","Check provider status page or retry with backoff if the wrapped error is a 5xx or rate-limit"],"exampleFix":"// before\nhandle, err := session.Resolve(ctx, key) // fails: get bound remote sandbox: ...\n// after\nif err != nil {\n    var stale *StaleBindingError\n    if errors.As(err, &stale) {\n        _ = bindings.Delete(ctx, key) // clear stale binding, then retry Resolve\n        handle, err = session.Resolve(ctx, key)\n    }\n}","handlingStrategy":"try-catch","validationCode":"// before resolving, verify provider reachability and credentials\nif err := client.Ping(ctx); err != nil {\n    return fmt.Errorf(\"provider unreachable before resolve: %w\", err)\n}","typeGuard":"func isReplaceable(err error) bool { return sandbox.CanReplaceRemoteBinding(err) }","tryCatchPattern":"handle, err := session.Resolve(ctx, key)\nif err != nil {\n    var root error = err\n    if unwrapped := errors.Unwrap(err); unwrapped != nil { root = unwrapped }\n    if isTransient(root) { /* retry with backoff */ }\n    if sandbox.CanReplaceRemoteBinding(root) { /* stale binding: delete and re-resolve */ }\n}","preventionTips":["Monitor provider API health before resuming sessions","Use retry with exponential backoff on resolve failures","Rotate credentials before expiry, not after","Delete bindings for sandboxes you terminate out-of-band"],"tags":["network","remote-sandbox","binding-resolution","wrapped-error"],"backgroundTag":"remote-sandbox-get-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}