{"record":{"id":"1c2f2cb4c3206248","repo":"sipeed/picoclaw","slug":"singleton-check-failed-w","errorCode":null,"errorMessage":"singleton check failed: %w","messagePattern":"singleton check failed: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gateway/gateway.go","lineNumber":181,"sourceCode":"\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 {\n\t\t\t_ = ln.Close()\n\t\t}\n\t}()\n\n\tprovider, modelID, err := createStartupProvider(cfg, allowEmptyStartup)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating provider: %w\", err)\n\t}\n\n\tif modelID != \"\" {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/gateway/gateway.go#L163-L199","documentation":"Error \"singleton check failed: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/gateway/gateway.go:181 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"}