larksuite/cli · error

bus probe: read status

Error message

bus probe: read status: %w

What it means

probeAndDialBus connected a socket to the event bus address and sent a StatusQuery, but protocol.ReadFrame returned an error before a status line arrived (the probe socket has a 2s deadline). Typically a mid-shutdown or wedged listener that accepts connections then goes silent.

Solutions

  1. Check the bus process and its log file, then let EnsureBus respawn it
  2. Verify no stale socket file survives a crashed bus process
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/event/consume/startup.go:113 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/bd3a30458f502639. Report an issue: GitHub.

Appendix: source

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

		WithHint("check app credentials (`lark-cli config show`) and retry; bus logs: %s", logPath)
}

// probeAndDialBus distinguishes a healthy bus from a mid-shutdown listener via StatusQuery first.
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
	}

View on GitHub (pinned to 7fd6ef3c07)