larksuite/cli · error

bus probe: decode status: %w

Error message

bus probe: decode status: %w

What it means

Wraps a decode failure of the bus's status-reply frame during the startup probe in probeAndDialBus. The probe connection answered but the bytes returned could not be parsed as a protocol message, so the bus daemon is considered unhealthy and the connection is abandoned.

Source

Thrown at internal/event/consume/startup.go:117

func probeAndDialBus(tr transport.IPC, addr string) (net.Conn, error) {
	probe, err := tr.Dial(addr)
	if err != nil {
		return nil, err
	}
	probe.SetDeadline(time.Now().Add(2 * time.Second))
	if err := protocol.Encode(probe, protocol.NewStatusQuery()); err != nil {
		probe.Close()
		return nil, fmt.Errorf("bus probe: encode: %w", err)
	}
	br := bufio.NewReader(probe)
	line, err := protocol.ReadFrame(br)
	probe.Close()
	if err != nil {
		return nil, fmt.Errorf("bus probe: read status: %w", err)
	}
	msg, err := protocol.Decode(bytes.TrimRight(line, "\n"))
	if err != nil {
		return nil, fmt.Errorf("bus probe: decode status: %w", err)
	}
	if _, ok := msg.(*protocol.StatusResponse); !ok {
		return nil, fmt.Errorf("bus probe: expected StatusResponse, got %T", msg)
	}

	return tr.Dial(addr)
}

// forkBus holds bus.fork.lock until the spawned daemon is dial-able, so concurrent callers can't race past the empty-socket gap and fork independent buses.
func forkBus(tr transport.IPC, appID, profileName, domain string) (int, error) {
	lockPath := filepath.Join(core.GetConfigDir(), "events", event.SanitizeAppID(appID), "bus.fork.lock")
	if err := vfs.MkdirAll(filepath.Dir(lockPath), 0700); err != nil {
		return 0, err
	}

	lock := lockfile.New(lockPath)
	if err := lock.TryLock(); err != nil {
		return 0, err

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Confirm the socket address points at a current-version CLI bus, not another process
  2. Remove stale sockets and logs and let the bus restart
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/event/consume/startup.go:117 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/871e31c383584a33. Report an issue: GitHub.