{"record":{"id":"f9282233bcdbe79c","repo":"Tencent/WeKnora","slug":"delete-sandbox-binding-w-f92822","errorCode":null,"errorMessage":"delete sandbox binding: %w","messagePattern":"delete sandbox binding: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_lifecycle.go","lineNumber":498,"sourceCode":"\tctx context.Context,\n\tkey SessionSandboxKey,\n\tbinding SessionSandboxBinding,\n) error {\n\tif binding.Provider == l.client.Provider() {\n\t\terr := l.client.Delete(ctx, binding.SandboxID)\n\t\tif err != nil && !CanReplaceRemoteBinding(err) {\n\t\t\treturn fmt.Errorf(\"delete remote sandbox: %w\", err)\n\t\t}\n\t}\n\n\tdeleted, err := l.bindings.DeleteIfMatch(\n\t\tctx,\n\t\tkey,\n\t\tbinding.Provider,\n\t\tbinding.SandboxID,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"delete sandbox binding: %w\", err)\n\t}\n\tif deleted {\n\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) {","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_lifecycle.go#L480-L516","documentation":"After deleting (or tolerating a replaceable delete of) the remote sandbox, destroyBindingLocked removes the binding record from the store via DeleteIfMatch. If that store operation fails, the destroy is aborted with this wrapped error — the sandbox may already be gone but the binding record still exists.","triggerScenarios":"DeleteIfMatch on the SessionSandboxBindingStore returns an error during session destroy: store outage, timeout, auth failure, or context cancellation mid-delete.","commonSituations":"Binding-store connectivity problems; store credentials/ACL changed; long-running destroy racing a request cancellation (context deadline exceeded).","solutions":["Fix the underlying store error surfaced by the %w chain and retry the destroy","Verify store connectivity, auth, and write permissions for the session key","Increase the context timeout if destroys are being cancelled under load","If the sandbox was already deleted, manually remove the stale binding record to unblock future resolves"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := manager.DestroySession(ctx, key)\nif err != nil && strings.Contains(err.Error(), \"delete sandbox binding\") {\n    // store write failed; retry destroy or purge stale binding manually\n    log.Printf(\"binding delete failed: %v\", err)\n}","preventionTips":["Keep contexts long enough for store writes during teardown","Verify store write ACLs after credential rotations","Alert on destroy failures since they leave orphaned bindings"],"tags":["go","binding-store","delete","teardown"],"backgroundTag":"binding-store-write-failure","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}