Tencent/WeKnora · error

delete sandbox binding: %w

Error message

delete sandbox binding: %w

What it means

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.

Source

Thrown at internal/sandbox/session_lifecycle.go:498

	ctx context.Context,
	key SessionSandboxKey,
	binding SessionSandboxBinding,
) error {
	if binding.Provider == l.client.Provider() {
		err := l.client.Delete(ctx, binding.SandboxID)
		if err != nil && !CanReplaceRemoteBinding(err) {
			return fmt.Errorf("delete remote sandbox: %w", err)
		}
	}

	deleted, err := l.bindings.DeleteIfMatch(
		ctx,
		key,
		binding.Provider,
		binding.SandboxID,
	)
	if err != nil {
		return fmt.Errorf("delete sandbox binding: %w", err)
	}
	if deleted {
		return nil
	}
	current, err := l.readBinding(ctx, key)
	if err != nil {
		return err
	}
	if current == nil {
		return nil
	}
	return errors.New("sandbox binding changed during destroy")
}

func (l *remoteSessionLifecycle) readBinding(
	ctx context.Context,
	key SessionSandboxKey,
) (*SessionSandboxBinding, error) {

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Fix the underlying store error surfaced by the %w chain and retry the destroy
  2. Verify store connectivity, auth, and write permissions for the session key
  3. Increase the context timeout if destroys are being cancelled under load
  4. If the sandbox was already deleted, manually remove the stale binding record to unblock future resolves
Defensive patterns

Strategy: try-catch

Try / catch

err := manager.DestroySession(ctx, key)
if err != nil && strings.Contains(err.Error(), "delete sandbox binding") {
    // store write failed; retry destroy or purge stale binding manually
    log.Printf("binding delete failed: %v", err)
}

Prevention

When it happens

Trigger: DeleteIfMatch on the SessionSandboxBindingStore returns an error during session destroy: store outage, timeout, auth failure, or context cancellation mid-delete.

Common situations: Binding-store connectivity problems; store credentials/ACL changed; long-running destroy racing a request cancellation (context deadline exceeded).

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/f9282233bcdbe79c. Report an issue: GitHub.