slymnoyann/hey-1 · critical · Error

No response from refresh

Error message

No response from refresh

What it means

Thrown by executeTokenRefresh when the GraphQL refresh mutation resolves but data.refresh is null or undefined. In other words, the server responded successfully (no GraphQL error) yet the refresh field is absent from the response payload, so there is nothing to authenticate with.

Source

Thrown at src/helpers/tokenManager.ts:21

import { RefreshDocument, type RefreshMutation } from "@/indexer/generated";
import { signIn, signOut } from "@/store/persisted/useAuthStore";
import type { JwtPayload } from "@/types/jwt";

let refreshPromise: Promise<string> | null = null;
const MAX_RETRIES = 5;

const executeTokenRefresh = async (refreshToken: string): Promise<string> => {
  try {
    for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
      const { data } = await apolloClient.mutate<RefreshMutation>({
        mutation: RefreshDocument,
        variables: { request: { refreshToken } }
      });

      const refreshResult = data?.refresh;

      if (!refreshResult) {
        throw new Error("No response from refresh");
      }

      if (refreshResult.__typename === "AuthenticationTokens") {
        const { accessToken: newAccessToken, refreshToken: newRefreshToken } =
          refreshResult;

        if (!newAccessToken || !newRefreshToken) {
          throw new Error("Missing tokens in refresh response");
        }

        signIn({
          accessToken: newAccessToken,
          refreshToken: newRefreshToken
        });

        return newAccessToken;
      }

View on GitHub (pinned to 88c8f9d553)

Solutions

  1. Check whether the refresh token in storage is expired/malformed; clear it and force re-login if so
  2. Log the full GraphQL result (data and errors) to see whether the mutation returned errors that were hidden
  3. Verify the refresh mutation query string still matches the current API schema
  4. Add offline detection before attempting refresh, and treat undefined data as a retryable network condition

Example fix

// before
if (!refreshResult) {
  throw new Error("No response from refresh");
}

// after
if (!refreshResult) {
  if (typeof navigator !== "undefined" && !navigator.onLine) {
    throw new Error("Network unavailable during token refresh");
  }
  throw new Error("No response from refresh");
}
Defensive patterns

Strategy: retry

Validate before calling

if (!refreshToken || typeof refreshToken !== "string") {
  signOut();
  throw new Error("No refresh token available");
}
if (typeof navigator !== "undefined" && !navigator.onLine) {
  throw new Error("Offline; cannot refresh tokens");
}

Type guard

const hasRefreshPayload = (d: unknown): d is { refresh: unknown } =>
  typeof d === "object" && d !== null && "refresh" in d && (d as { refresh: unknown }).refresh != null;

Try / catch

try {
  const token = await refreshTokens(refreshToken);
} catch (e) {
  if (e instanceof Error && e.message === "No response from refresh") {
    await new Promise((r) => setTimeout(r, 2000));
    return refreshTokens(refreshToken); // one manual retry
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the refresh mutation when the server returns a 200 response with an errors array consumed silently by the client, a partial response where the refresh field is missing, or a network/transport layer that resolves with undefined data (offline or interrupted request).

Common situations: Expired or malformed refresh token that the server rejects softly, Apollo/GraphQL client misconfiguration swallowing errors into a partial data object, API schema changes removing the refresh field, or intermittent network failures where data is undefined.

Related errors


AI-assisted analysis of slymnoyann/hey-1@88c8f9d553 (2026-08-28). Data as JSON: /api/errors/afe51ff0c0d33116. Report an issue: GitHub.