{"record":{"id":"ab8a94d82b20c915","repo":"sipeed/picoclaw","slug":"config-pre-check-failed-w","errorCode":null,"errorMessage":"config pre-check failed: %w","messagePattern":"config pre-check failed: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gateway/gateway.go","lineNumber":157,"sourceCode":"\tdefer func() {\n\t\tif runErr != nil {\n\t\t\tlogger.ErrorCF(\"gateway\", \"Gateway startup failed\", map[string]any{\n\t\t\t\t\"config_path\": configPath,\n\t\t\t\t\"error\":       runErr.Error(),\n\t\t\t\t\"home_path\":   homePath,\n\t\t\t\t\"allow_empty\": allowEmptyStartup,\n\t\t\t\t\"debug\":       debug,\n\t\t\t})\n\t\t}\n\t}()\n\n\tcfg, err := config.LoadConfig(configPath)\n\tif err != nil {\n\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)","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/gateway/gateway.go#L139-L175","documentation":"preCheckConfig rejected the loaded config during gateway Run (invalid gateway port range or another startup-blocking invariant). The failure is wrapped so startup halts before listeners and providers are created.","triggerScenarios":"Thrown at pkg/gateway/gateway.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped message; fix gateway.port if it is outside 1-65535","Validate the config in the web UI before restarting","Correct the flagged setting in config.json and restart the gateway"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}