{"record":{"id":"20e8d3097d33c18f","repo":"juanfont/headscale","slug":"w-s-20e8d3","errorCode":null,"errorMessage":"%w: %s","messagePattern":"%w: %s","errorType":"console","errorClass":"ErrUnsupportedPolicyMode","httpStatus":null,"severity":"error","filePath":"hscontrol/state/debug.go","lineNumber":213,"sourceCode":"// DebugPolicy returns the current policy data as a string.\nfunc (s *State) DebugPolicy() (string, error) {\n\tswitch s.cfg.Policy.Mode {\n\tcase types.PolicyModeDB:\n\t\tp, err := s.GetPolicy()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\treturn p.Data, nil\n\tcase types.PolicyModeFile:\n\t\tpol, err := hsdb.PolicyBytes(s.db.DB, s.cfg)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\treturn string(pol), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"%w: %s\", ErrUnsupportedPolicyMode, s.cfg.Policy.Mode)\n\t}\n}\n\n// DebugFilter returns the current filter rules and matchers.\nfunc (s *State) DebugFilter() ([]tailcfg.FilterRule, error) {\n\tfilter, _ := s.Filter()\n\treturn filter, nil\n}\n\n// DebugRoutes returns the current primary routes information as a\n// structured object built from the [NodeStore] snapshot.\nfunc (s *State) DebugRoutes() types.DebugRoutes {\n\tdebug := types.DebugRoutes{\n\t\tAvailableRoutes: make(map[types.NodeID][]netip.Prefix),\n\t\tPrimaryRoutes:   make(map[string]types.NodeID),\n\t}\n\n\tfor _, nv := range s.nodeStore.ListNodes().All() {","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/state/debug.go#L195-L231","documentation":"Error \"%w: %s\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/state/debug.go:213 when the library encounters an invalid state.","commonSituations":"A debug endpoint operation failed with the embedded message. Check that the debug handler's prerequisites (valid node, enabled debug access) are met.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (); 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-15T22:17:37.221Z"}