chenhg5/cc-connect · error

matrix: platform stopped

Error message

matrix: platform stopped

What it means

Lifecycle guard in Matrix Platform.Start: the platform's Stop() has already set the stopping flag, so a subsequent Start attempt is rejected to prevent resurrecting a shut-down platform.

Source

Thrown at platform/matrix/matrix.go:133

		groupReplyAll:         groupReplyAll,
		shareSessionInChannel: shareSession,
		autoJoin:              autoJoin,
		proxyURL:              proxyURL,
		autoVerify:            autoVerify,
		crossSigningPassword:  crossSigningPassword,
		httpClient:            httpClient,
		dedup:                 core.MessageDedup{},
	}, nil
}

func (p *Platform) Name() string { return "matrix" }

func (p *Platform) Start(handler core.MessageHandler) error {
	p.mu.Lock()
	defer p.mu.Unlock()

	if p.stopping {
		return fmt.Errorf("matrix: platform stopped")
	}

	ctx, cancel := context.WithCancel(context.Background())
	p.handler = handler
	p.cancel = cancel

	go p.connectLoop(ctx)
	return nil
}

func (p *Platform) SetLifecycleHandler(h core.PlatformLifecycleHandler) {
	p.mu.Lock()
	defer p.mu.Unlock()
	p.lifecycleHandler = h
}

func (p *Platform) connectLoop(ctx context.Context) {
	backoff := initialBackoff

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Create a new Platform instance instead of restarting a stopped one
  2. Ensure Stop is only called at final shutdown
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at platform/matrix/matrix.go:133 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/cc028e8727738b32. Report an issue: GitHub.