heygen-com/hyperframes · error

selection endpoint returned ${response.status}

Error message

selection endpoint returned ${response.status}

What it means

Thrown by fetchStudioSelection when the Studio preview server's /api/projects/<projectName>/selection endpoint returns a non-OK HTTP status. This endpoint provides the current selection state from the Studio editor. A non-OK response typically means the server is unhealthy, the project name doesn't match, or the route isn't registered.

Source

Thrown at packages/cli/src/utils/studioSelectionClient.ts:143

          version: "studio-dev",
          pid: null,
        };
      } catch {
        // Not a Vite-served Studio on this host/port, or unreachable. Try next.
      }
    }
  }
  return null;
}

export async function fetchStudioSelection(
  server: ActiveServer,
  fetchImpl: typeof fetch = fetch,
): Promise<StudioSelectionResponse> {
  const url = studioSelectionUrl(server);
  const response = await fetchImpl(url);
  if (!response.ok) {
    throw new Error(`selection endpoint returned ${response.status}`);
  }
  return (await response.json()) as StudioSelectionResponse;
}

export async function fetchStudioLint(
  server: ActiveServer,
  fetchImpl: typeof fetch = fetch,
): Promise<StudioLintResponse> {
  const url = studioApiUrl(server, "lint");
  const response = await fetchImpl(url);
  if (!response.ok) {
    throw new Error(`lint endpoint returned ${response.status}`);
  }
  return (await response.json()) as StudioLintResponse;
}

View on GitHub (pinned to c2996c8626)

Solutions

  1. Restart the Studio preview server and retry.
  2. Ensure the CLI version matches the Studio server version (update both).
  3. Check the Studio server logs for the route handler error.
  4. Verify the project name is correct (it must match the directory/project registered in Studio).
Defensive patterns

Strategy: retry

Validate before calling

async function isSelectionEndpointHealthy(server: ActiveServer): Promise<boolean> {
  try {
    const res = await fetch(studioSelectionUrl(server), { signal: AbortSignal.timeout(3000) });
    return res.ok;
  } catch {
    return false;
  }
}

Try / catch

try {
  const selection = await fetchStudioSelection(server);
} catch (err) {
  if (err instanceof Error && err.message.includes("selection endpoint")) {
    console.warn(`Studio selection endpoint unhealthy (${err.message}). Falling back to file-based selection.`);
    return readSelectionFromDisk();
  }
  throw err;
}

Prevention

When it happens

Trigger: The Studio server is running but its selection route handler crashed; the project name encoded in the URL doesn't match any project the server knows about; the server is mid-restart or in a degraded state; a version mismatch between the CLI and the running Studio server.

Common situations: Studio server was updated but not restarted; the project was renamed in Studio but the CLI cached an old name; the server process is partially crashed (still listening on the port but routes are dead).

Related errors


AI-assisted analysis of heygen-com/hyperframes@c2996c8626 (2026-08-12). Data as JSON: /api/errors/66818120c1f7d2fe. Report an issue: GitHub.