juanfont/headscale · error · errResponseStatus

%w: %d %s

Error message

%w: %d %s

What it means

Error "%w: %d %s" thrown in juanfont/headscale.

Source

Thrown at cmd/headscale/cli/utils.go:50

	outputFormatJSON     = "json"
	outputFormatJSONLine = "json-line"
	outputFormatYAML     = "yaml"
)

var (
	errAPIKeyNotSet     = errors.New("HEADSCALE_CLI_API_KEY environment variable needs to be set")
	errMissingParameter = errors.New("missing parameters")
	errResponseStatus   = errors.New("unexpected response status")
)

// apiError turns a non-2xx response into an error, surfacing the server's
// RFC7807 problem detail. detail holds the operation context and errors[] the
// wrapped cause (e.g. "name is too long"); both are joined so the server's
// message text is not lost.
func apiError(statusCode int, problem *clientv1.ErrorModel) error {
	if problem == nil {
		return fmt.Errorf("%w: %d %s", errResponseStatus, statusCode, http.StatusText(statusCode))
	}

	parts := make([]string, 0, 2)

	if problem.Detail != nil && *problem.Detail != "" {
		parts = append(parts, *problem.Detail)
	}

	if problem.Errors != nil {
		for _, e := range *problem.Errors {
			if e.Message != nil && *e.Message != "" {
				parts = append(parts, *e.Message)
			}
		}
	}

	if len(parts) == 0 && problem.Title != nil && *problem.Title != "" {
		parts = append(parts, *problem.Title)

View on GitHub (pinned to 565fd254d0)

Solutions

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

When it happens

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

Common situations: A gRPC status error was returned by the server for the CLI request. Read the embedded code and message for the specific failure and check server logs.


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