{"record":{"id":"537ee06259ac89e0","repo":"juanfont/headscale","slug":"w-v-are-invalid-or-not-permitted","errorCode":null,"errorMessage":"%w %v are invalid or not permitted","messagePattern":"%w (.+?) are invalid or not permitted","errorType":"validation","errorClass":"ErrRequestedTagsInvalidOrNotPermitted","httpStatus":400,"severity":"error","filePath":"hscontrol/state/state.go","lineNumber":963,"sourceCode":"\t\treturn types.NodeView{}, change.Change{}, fmt.Errorf(\"%w: %d\", ErrNodeNotFound, nodeID)\n\t}\n\n\t// Validate tags: must have correct format and exist in policy\n\tvalidatedTags := make([]string, 0, len(tags))\n\tinvalidTags := make([]string, 0)\n\n\tfor _, tag := range tags {\n\t\tif !strings.HasPrefix(tag, \"tag:\") || !s.polMan.TagExists(tag) {\n\t\t\tinvalidTags = append(invalidTags, tag)\n\n\t\t\tcontinue\n\t\t}\n\n\t\tvalidatedTags = append(validatedTags, tag)\n\t}\n\n\tif len(invalidTags) > 0 {\n\t\treturn types.NodeView{}, change.Change{}, fmt.Errorf(\"%w %v are invalid or not permitted\", ErrRequestedTagsInvalidOrNotPermitted, invalidTags)\n\t}\n\n\tslices.Sort(validatedTags)\n\tvalidatedTags = slices.Compact(validatedTags)\n\n\t// Log the operation\n\tlogTagOperation(existingNode, validatedTags)\n\n\t// Update [NodeStore] before database to ensure consistency. The [NodeStore] update\n\t// is blocking and will be the source of truth for the batcher. The database update\n\t// must make the exact same change.\n\tn, ok := s.nodeStore.UpdateNode(nodeID, func(node *types.Node) {\n\t\tnode.Tags = validatedTags\n\t\t// Tagged nodes are owned by their tags, not a user.\n\t\tnode.UserID = nil\n\t\tnode.User = nil\n\t})\n","sourceCodeStart":945,"sourceCodeEnd":981,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/state/state.go#L945-L981","documentation":"Error \"%w %v are invalid or not permitted\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/state/state.go:963 when the library encounters an invalid state.","commonSituations":"The requested tags are invalid or the caller is not permitted to set them. Ensure tags start with 'tag:' and the node owner is listed in tagOwners.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (%v are invalid or not permitted); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (%v are invalid or not permitted); 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"}