{"record":{"id":"66818120c1f7d2fe","repo":"heygen-com/hyperframes","slug":"selection-endpoint-returned-response-status","errorCode":null,"errorMessage":"selection endpoint returned ${response.status}","messagePattern":"selection endpoint returned (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/studioSelectionClient.ts","lineNumber":143,"sourceCode":"          version: \"studio-dev\",\n          pid: null,\n        };\n      } catch {\n        // Not a Vite-served Studio on this host/port, or unreachable. Try next.\n      }\n    }\n  }\n  return null;\n}\n\nexport async function fetchStudioSelection(\n  server: ActiveServer,\n  fetchImpl: typeof fetch = fetch,\n): Promise<StudioSelectionResponse> {\n  const url = studioSelectionUrl(server);\n  const response = await fetchImpl(url);\n  if (!response.ok) {\n    throw new Error(`selection endpoint returned ${response.status}`);\n  }\n  return (await response.json()) as StudioSelectionResponse;\n}\n\nexport async function fetchStudioLint(\n  server: ActiveServer,\n  fetchImpl: typeof fetch = fetch,\n): Promise<StudioLintResponse> {\n  const url = studioApiUrl(server, \"lint\");\n  const response = await fetchImpl(url);\n  if (!response.ok) {\n    throw new Error(`lint endpoint returned ${response.status}`);\n  }\n  return (await response.json()) as StudioLintResponse;\n}\n","sourceCodeStart":125,"sourceCodeEnd":159,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/utils/studioSelectionClient.ts#L125-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Restart the Studio preview server and retry.","Ensure the CLI version matches the Studio server version (update both).","Check the Studio server logs for the route handler error.","Verify the project name is correct (it must match the directory/project registered in Studio)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function isSelectionEndpointHealthy(server: ActiveServer): Promise<boolean> {\n  try {\n    const res = await fetch(studioSelectionUrl(server), { signal: AbortSignal.timeout(3000) });\n    return res.ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const selection = await fetchStudioSelection(server);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"selection endpoint\")) {\n    console.warn(`Studio selection endpoint unhealthy (${err.message}). Falling back to file-based selection.`);\n    return readSelectionFromDisk();\n  }\n  throw err;\n}","preventionTips":["Restart the Studio server if routes become unresponsive.","Keep CLI and Studio versions in sync.","Verify the project name matches what's registered in Studio."],"tags":["studio","network","http","preview-server"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}