{"record":{"id":"88afdc1a407e57f8","repo":"sipeed/picoclaw","slug":"reload-already-in-progress","errorCode":null,"errorMessage":"reload already in progress","messagePattern":"reload already in progress","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/gateway/gateway.go","lineNumber":232,"sourceCode":"\n\trunningServices, err := setupAndStartServices(cfg, agentLoop, msgBus, pidData.Token, listenResult)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// All services (channels + shared HTTP server) are up; mark the health\n\t// server ready so GET /ready reports \"ready\". The health endpoints are\n\t// mounted on the shared gateway mux, so Health.Server.Start() (which would\n\t// otherwise set this) is never called — we flip the flag explicitly here.\n\trunningServices.HealthServer.SetReady(true)\n\tpublishGatewayEvent(agentLoop, runtimeevents.KindGatewayReady, startedAt, nil)\n\tcloseListeners = false\n\n\t// Setup manual reload channel for /reload endpoint\n\tmanualReloadChan := make(chan struct{}, 1)\n\trunningServices.manualReloadChan = manualReloadChan\n\treloadTrigger := func() error {\n\t\tif !runningServices.reloading.CompareAndSwap(false, true) {\n\t\t\treturn fmt.Errorf(\"reload already in progress\")\n\t\t}\n\t\tselect {\n\t\tcase manualReloadChan <- struct{}{}:\n\t\t\treturn nil\n\t\tdefault:\n\t\t\t// Should not happen, but reset flag if channel is full\n\t\t\trunningServices.reloading.Store(false)\n\t\t\treturn fmt.Errorf(\"reload already queued\")\n\t\t}\n\t}\n\trunningServices.HealthServer.SetReloadFunc(reloadTrigger)\n\tagentLoop.SetReloadFunc(reloadTrigger)\n\n\tfor _, bindHost := range listenResult.BindHosts {\n\t\tfmt.Printf(\"✓ Gateway started on %s\\n\", net.JoinHostPort(bindHost, strconv.Itoa(cfg.Gateway.Port)))\n\t}\n\tfmt.Println(\"Press Ctrl+C to stop\")\n","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/gateway/gateway.go#L214-L250","documentation":"Error \"reload already in progress\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/gateway/gateway.go:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}