juanfont/headscale · error

invalid picture URL: %w

Error message

invalid picture URL: %w

What it means

Error "invalid picture URL: %w" thrown in juanfont/headscale.

Source

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

		return nil
	},
	RunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {
		userName := args[0]

		request := clientv1.CreateUserJSONRequestBody{Name: &userName}

		if displayName, _ := cmd.Flags().GetString("display-name"); displayName != "" {
			request.DisplayName = &displayName
		}

		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")
	}),

View on GitHub (pinned to 565fd254d0)

Solutions

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

When it happens

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

Common situations: The --picture-url value is not a valid URL. Provide an absolute http(s) URL for the user's avatar.


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