{"record":{"id":"cc61d034b3ae81ae","repo":"sipeed/picoclaw","slug":"error-opening-gateway-listeners-w","errorCode":null,"errorMessage":"error opening gateway listeners: %w","messagePattern":"error opening gateway listeners: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gateway/gateway.go","lineNumber":171,"sourceCode":"\t\treturn fmt.Errorf(\"error loading config: %w\", err)\n\t}\n\n\tif err = preCheckConfig(cfg); err != nil {\n\t\treturn fmt.Errorf(\"config pre-check failed: %w\", err)\n\t}\n\n\t// Debug mode permanently overrides the config log level to DEBUG.\n\tif debug {\n\t\tfmt.Println(\"🔍 Debug mode enabled\")\n\t} else {\n\t\teffectiveLogLevel := config.EffectiveGatewayLogLevel(cfg)\n\t\tlogger.SetLevelFromString(effectiveLogLevel)\n\t\tlogger.Infof(\"Log level set to %q\", effectiveLogLevel)\n\t}\n\n\tbindPlan, listenResult, err := openGatewayListeners(cfg.Gateway.Host, cfg.Gateway.Port)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error opening gateway listeners: %w\", err)\n\t}\n\n\t// Enforce singleton: write PID file with generated token.\n\tpidData, err := pid.WritePidFile(homePath, bindPlan.ProbeHost, cfg.Gateway.Port)\n\tif err != nil {\n\t\tlogger.Warnf(\"write pid file failed: %v\", err)\n\t\tfor _, ln := range listenResult.Listeners {\n\t\t\t_ = ln.Close()\n\t\t}\n\t\treturn fmt.Errorf(\"singleton check failed: %w\", err)\n\t}\n\tdefer pid.RemovePidFile(homePath)\n\tcloseListeners := true\n\tdefer func() {\n\t\tif !closeListeners {\n\t\t\treturn\n\t\t}\n\t\tfor _, ln := range listenResult.Listeners {","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/gateway/gateway.go#L153-L189","documentation":"Error \"error opening gateway listeners: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/gateway/gateway.go:171 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-15T22:17:37.221Z"}