sipeed/picoclaw · error

reload already queued

Error message

reload already queued

What it means

Second guard in the manual reload trigger: the reloading flag was acquired, but the manualReloadChan (capacity 1) already holds a pending reload signal, so this request would be silently dropped. The flag is released and the caller is told a reload is already queued.

Solutions

  1. No action needed — a reload is already pending and will run
  2. Wait for the queued reload to complete before requesting another
  3. Check logs to confirm the queued reload succeeded
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/gateway/gateway.go:240 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/3b67a938cd800ea3. Report an issue: GitHub.

Appendix: source

Thrown at pkg/gateway/gateway.go:240

	// otherwise set this) is never called — we flip the flag explicitly here.
	runningServices.HealthServer.SetReady(true)
	publishGatewayEvent(agentLoop, runtimeevents.KindGatewayReady, startedAt, nil)
	closeListeners = false

	// Setup manual reload channel for /reload endpoint
	manualReloadChan := make(chan struct{}, 1)
	runningServices.manualReloadChan = manualReloadChan
	reloadTrigger := func() error {
		if !runningServices.reloading.CompareAndSwap(false, true) {
			return fmt.Errorf("reload already in progress")
		}
		select {
		case manualReloadChan <- struct{}{}:
			return nil
		default:
			// Should not happen, but reset flag if channel is full
			runningServices.reloading.Store(false)
			return fmt.Errorf("reload already queued")
		}
	}
	runningServices.HealthServer.SetReloadFunc(reloadTrigger)
	agentLoop.SetReloadFunc(reloadTrigger)

	for _, bindHost := range listenResult.BindHosts {
		fmt.Printf("✓ Gateway started on %s\n", net.JoinHostPort(bindHost, strconv.Itoa(cfg.Gateway.Port)))
	}
	fmt.Println("Press Ctrl+C to stop")

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	go agentLoop.Run(ctx)

	var configReloadChan <-chan *config.Config
	stopWatch := func() {}
	if cfg.Gateway.HotReload {

View on GitHub (pinned to 49183d7e8d)