juanfont/headscale · error

looking up user

Error message

looking up user: %w

What it means

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

Solutions

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

When it happens

Trigger: Thrown at hscontrol/oidc.go:827 when the library encounters an invalid state.

Common situations: The database lookup of the OIDC-authenticated user failed. Check database connectivity and server logs for the underlying error.


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

Appendix: source

Thrown at hscontrol/oidc.go:827

		return
	}

	pending := authReq.PendingConfirmation()
	if pending == nil {
		httpUserError(writer, NewHTTPError(http.StatusForbidden, "registration not OIDC-authorized", nil))

		return
	}

	if pending.CSRF != cookie.Value {
		httpUserError(writer, NewHTTPError(http.StatusForbidden, "csrf token does not match cached registration", nil))

		return
	}

	user, err := a.h.state.GetUserByID(types.UserID(pending.UserID))
	if err != nil {
		httpUserError(writer, fmt.Errorf("looking up user: %w", err))

		return
	}

	newNode, err := a.handleRegistration(user, authID, pending.NodeExpiry)
	if err != nil {
		if errors.Is(err, db.ErrNodeNotFoundRegistrationCache) {
			httpUserError(writer, NewHTTPError(http.StatusGone, "registration session expired", err))

			return
		}

		httpUserError(writer, err)

		return
	}

	// Clear the CSRF cookie now that the registration is final.

View on GitHub (pinned to 565fd254d0)