Tencent/WeKnora · error

list owned remote sandboxes: %w

Error message

list owned remote sandboxes: %w

What it means

This error wraps a failure from client.List when the lifecycle tries to recover an orphaned sandbox by listing sandboxes matching the session's metadata. If the provider's List call fails (and the error is not otherwise handled), recovery is aborted with 'list owned remote sandboxes: %w' instead of silently creating a duplicate sandbox.

Source

Thrown at internal/sandbox/session_lifecycle.go:282

	if err := l.validateHandle(handle, binding.SandboxID); err != nil {
		return nil, false, err
	}
	return handle, false, nil
}

func (l *remoteSessionLifecycle) recoverOwnedSandbox(
	ctx context.Context,
	key SessionSandboxKey,
) (RemoteSandboxHandle, bool, error) {
	capabilities := l.client.Capabilities()
	if !capabilities.SupportsMetadata || !capabilities.SupportsListSandboxes {
		return nil, false, nil
	}

	metadata := l.metadata(key)
	summaries, err := l.client.List(ctx, RemoteListFilter{Metadata: metadata})
	if err != nil {
		return nil, false, fmt.Errorf("list owned remote sandboxes: %w", err)
	}
	sort.Slice(summaries, func(i, j int) bool {
		left, right := summaries[i], summaries[j]
		if left.StartedAt.Equal(right.StartedAt) {
			return left.ID < right.ID
		}
		if left.StartedAt.IsZero() {
			return false
		}
		if right.StartedAt.IsZero() {
			return true
		}
		return left.StartedAt.Before(right.StartedAt)
	})

	for _, summary := range summaries {
		if summary.ID == "" || summary.State == RemoteStateTerminal {
			continue

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect the wrapped error for provider-specific filter validation messages and simplify/normalize the metadata values
  2. Confirm the provider genuinely supports metadata-filtered listing or disable the capability advertisement
  3. Check IAM/permissions for the list-sandboxes API
  4. Retry with backoff if the wrapped error is transient (5xx/throttle)

Example fix

// before
RemoteListFilter{Metadata: map[string]string{"session": keyWithSpaces}}
// after
RemoteListFilter{Metadata: map[string]string{"session": sanitize(key)}} // provider-safe values
Defensive patterns

Strategy: retry

Validate before calling

// confirm the client really supports metadata listing before relying on recovery
caps := client.Capabilities()
if !caps.SupportsMetadata || !caps.SupportsListSandboxes { /* skip recovery expectations */ }

Try / catch

handle, err := session.Resolve(ctx, key)
if err != nil && strings.HasPrefix(err.Error(), "list owned remote sandboxes:") {
    err = retryWithBackoff(ctx, 3, func() error { handle, err = session.Resolve(ctx, key); return err })
}

Prevention

When it happens

Trigger: client.List(ctx, RemoteListFilter{Metadata: metadata}) returns an error during resolveLocked's recovery path — provider API errors, network failures, malformed metadata filter rejected by the provider, or auth errors. Only reached when the client reports SupportsMetadata and SupportsListSandboxes capabilities.

Common situations: Provider does not actually support metadata filtering despite advertising the capability; metadata filter values contain characters the provider rejects; rate limiting on List; API outage; credentials lacking list permissions.

Related errors


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