juanfont/headscale · error

creating user: %w

Error message

creating user: %w

What it means

Error "creating user: %w" thrown in juanfont/headscale.

Source

Thrown at cmd/headscale/cli/users.go:143

		}

		if email, _ := cmd.Flags().GetString("email"); email != "" {
			request.Email = &email
		}

		if pictureURL, _ := cmd.Flags().GetString("picture-url"); pictureURL != "" {
			if _, err := url.Parse(pictureURL); err != nil { //nolint:noinlineerr
				return fmt.Errorf("invalid picture URL: %w", err)
			}

			request.PictureUrl = &pictureURL
		}

		log.Trace().Interface(zf.Request, request).Msg("sending CreateUser request")

		resp, err := client.CreateUserWithResponse(ctx, request)
		if err != nil {
			return fmt.Errorf("creating user: %w", err)
		}

		if resp.StatusCode() != http.StatusOK {
			return apiError(resp.StatusCode(), resp.ApplicationproblemJSONDefault)
		}

		return printOutput(cmd, resp.JSON200.User, "User created")
	}),
}

var destroyUserCmd = &cobra.Command{
	Use:     "destroy --identifier ID or --name NAME",
	Short:   "Destroys a user",
	Aliases: []string{cmdDelete},
	RunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {
		_, user, err := resolveSingleUser(ctx, client, cmd)
		if err != nil {
			return err

View on GitHub (pinned to 565fd254d0)

Solutions

  1. 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.

Example fix

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.

When it happens

Trigger: Thrown at cmd/headscale/cli/users.go:143 when the library encounters an invalid state.

Common situations: Creating the user failed. Common causes: the name already exists or violates username rules (min 2 chars, starts with a letter, at most one '@').


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/e2df0286969e561e. Report an issue: GitHub.