Tencent/WeKnora · error

sandbox: connect session sandbox: %w

Error message

sandbox: connect session sandbox: %w

What it means

Wrapping error in lookupSessionHandle when m.client.Connect to the bound sandbox ID fails with an error that is not a replaceable-binding condition (CanReplaceRemoteBinding returned false, so stale bindings are not silently ignored). Indicates the remote sandbox exists in the binding but cannot be connected to (crashed, network issue, or provider error).

Source

Thrown at internal/sandbox/session_manager.go:907

		return nil, false, nil
	}
	key, err := m.sessionKey(ctx, sessionID)
	if err != nil {
		return nil, false, err
	}
	binding, err := m.bindings.Get(ctx, key)
	if err != nil {
		return nil, false, fmt.Errorf("sandbox: read session binding: %w", err)
	}
	if binding == nil || binding.Provider != m.client.Provider() {
		return nil, false, nil
	}
	handle, err := m.client.Connect(ctx, binding.SandboxID)
	if err != nil {
		if CanReplaceRemoteBinding(err) {
			return nil, false, nil
		}
		return nil, false, fmt.Errorf("sandbox: connect session sandbox: %w", err)
	}
	if handle == nil || handle.ID() != binding.SandboxID ||
		handle.Provider() != m.client.Provider() {
		return nil, false, errors.New("sandbox: remote handle does not match binding")
	}
	return handle, true, nil
}

func (m *SessionBoundManager) listFilesRecursive(
	ctx context.Context,
	handle RemoteSandboxHandle,
	dir string,
) ([]RemoteDirEntry, error) {
	stat, err := m.client.Stat(ctx, handle, dir)
	if err != nil {
		if IsRemoteNotFound(err) {
			return nil, nil
		}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect the wrapped Connect error for sandbox state
  2. If the sandbox is gone, replace/recreate the binding rather than retrying connect
  3. Retry transient connection failures with backoff
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/sandbox/session_manager.go:907 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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