{"record":{"id":"b8dfbd6a520edc4a","repo":"juanfont/headscale","slug":"loading-users-w-b8dfbd","errorCode":null,"errorMessage":"loading users: %w","messagePattern":"loading users: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hscontrol/state/state.go","lineNumber":249,"sourceCode":"\tipAlloc, err := hsdb.NewIPAllocator(db, cfg.PrefixV4, cfg.PrefixV6, cfg.IPAllocation)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initializing IP allocator: %w\", err)\n\t}\n\n\tnodes, err := db.ListNodes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading nodes: %w\", err)\n\t}\n\n\t// On startup, all nodes should be marked as offline until they reconnect\n\t// This ensures we don't have stale online status from previous runs\n\tfor _, node := range nodes {\n\t\tnode.IsOnline = new(false)\n\t}\n\n\tusers, err := db.ListUsers(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading users: %w\", err)\n\t}\n\n\tpol, err := hsdb.PolicyBytes(db.DB, cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading policy: %w\", err)\n\t}\n\n\tpolMan, err := policy.NewPolicyManager(pol, users, nodes.ViewSlice())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"initializing policy manager: %w\", err)\n\t}\n\n\t// Apply defaults for [NodeStore] batch configuration if not set.\n\t// This ensures tests that create Config directly (without viper) still work.\n\tbatchSize := cmp.Or(cfg.Tuning.NodeStoreBatchSize, defaultNodeStoreBatchSize)\n\n\tbatchTimeout := cmp.Or(cfg.Tuning.NodeStoreBatchTimeout, defaultNodeStoreBatchTimeout)\n","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/state/state.go#L231-L267","documentation":"Error \"loading users: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/state/state.go:249 when the library encounters an invalid state.","commonSituations":"Loading users from the database at startup failed. Check database connectivity and schema validity.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (loading users); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (loading users); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}