Tencent/WeKnora · error

delete remote sandbox: %w

Error message

delete remote sandbox: %w

What it means

destroyBindingLocked deletes the remote sandbox backing a session binding before removing the binding record. If the provider Delete call fails and the error is not recognized as a benign 'binding replaceable' condition (CanReplaceRemoteBinding), the destroy is aborted with this wrapped error, leaving the sandbox running and the binding intact.

Source

Thrown at internal/sandbox/session_lifecycle.go:487

			return fmt.Errorf(
				"delete duplicate owned remote sandbox %q: %w",
				candidate.ID,
				err,
			)
		}
	}
	return nil
}

func (l *remoteSessionLifecycle) destroyBindingLocked(
	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

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Read the wrapped provider error; if the sandbox no longer exists, the binding may point to a stale record — reconcile the store
  2. Retry the destroy operation after transient provider failures
  3. Verify provider credentials/permissions allow deleting sandboxes
  4. Check CanReplaceRemoteBinding semantics: errors considered 'replaceable' are intentionally swallowed; anything else is fatal here
Defensive patterns

Strategy: try-catch

Try / catch

err := manager.DestroySession(ctx, key)
if err != nil && strings.Contains(err.Error(), "delete remote sandbox") {
    // inspect wrapped provider error; decide retry vs manual reconcile
    log.Printf("destroy failed: %v", err)
}

Prevention

When it happens

Trigger: Session destroy / resolve path calls client.Delete(binding.SandboxID) and the provider returns a persistent error: network failure, 4xx/5xx, wrong credentials, or the sandbox in a state where deletion is rejected and not deemed replaceable.

Common situations: Provider outage during teardown; deleted/expired sandbox IDs (binding points at a stale sandbox); IAM/credentials lacking delete permission on the provider account.

Related errors


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