{"record":{"id":"e2df0286969e561e","repo":"juanfont/headscale","slug":"creating-user-w-e2df02","errorCode":null,"errorMessage":"creating user: %w","messagePattern":"creating user: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/users.go","lineNumber":143,"sourceCode":"\t\t}\n\n\t\tif email, _ := cmd.Flags().GetString(\"email\"); email != \"\" {\n\t\t\trequest.Email = &email\n\t\t}\n\n\t\tif pictureURL, _ := cmd.Flags().GetString(\"picture-url\"); pictureURL != \"\" {\n\t\t\tif _, err := url.Parse(pictureURL); err != nil { //nolint:noinlineerr\n\t\t\t\treturn fmt.Errorf(\"invalid picture URL: %w\", err)\n\t\t\t}\n\n\t\t\trequest.PictureUrl = &pictureURL\n\t\t}\n\n\t\tlog.Trace().Interface(zf.Request, request).Msg(\"sending CreateUser request\")\n\n\t\tresp, err := client.CreateUserWithResponse(ctx, request)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"creating user: %w\", err)\n\t\t}\n\n\t\tif resp.StatusCode() != http.StatusOK {\n\t\t\treturn apiError(resp.StatusCode(), resp.ApplicationproblemJSONDefault)\n\t\t}\n\n\t\treturn printOutput(cmd, resp.JSON200.User, \"User created\")\n\t}),\n}\n\nvar destroyUserCmd = &cobra.Command{\n\tUse:     \"destroy --identifier ID or --name NAME\",\n\tShort:   \"Destroys a user\",\n\tAliases: []string{cmdDelete},\n\tRunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {\n\t\t_, user, err := resolveSingleUser(ctx, client, cmd)\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/users.go#L125-L161","documentation":"Error \"creating user: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/users.go:143 when the library encounters an invalid state.","commonSituations":"Creating the user failed. Common causes: the name already exists or violates username rules (min 2 chars, starts with a letter, at most one '@').","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (creating user); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (creating user); 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"}