juanfont/headscale · error

destroying user: %w

Error message

destroying user: %w

What it means

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

Source

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

	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
		}

		if !confirmAction(cmd, fmt.Sprintf(
			"Do you want to remove the user %q (%s) and any associated preauthkeys?",
			user.Name, user.Id,
		)) {
			return printOutput(cmd, map[string]string{colResult: "User not destroyed"}, "User not destroyed")
		}

		resp, err := client.DeleteUserWithResponse(ctx, user.Id)
		if err != nil {
			return fmt.Errorf("destroying user: %w", err)
		}

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

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

var listUsersCmd = &cobra.Command{
	Use:     cmdList,
	Short:   "List all the users",
	Aliases: []string{"ls", cmdShow},
	RunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {
		params := &clientv1.ListUsersParams{}

		id, _ := cmd.Flags().GetInt64("identifier")

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Inspect the wrapped error for the underlying cause and correct the failing condition (destroying 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 (destroying user); retry the operation after fixing the input, configuration, or environment.

When it happens

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

Common situations: Destroying the user failed. Ensure the user exists and has no remaining nodes registered.


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