{"record":{"id":"c5cd920fd4d57c6b","repo":"BloopAI/vibe-kanban","slug":"host-returned-http-response-status","errorCode":null,"errorMessage":"Host returned HTTP ${response.status}","messagePattern":"Host returned HTTP (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/remote-web/src/shared/hooks/useRelayWorkspaceHostHealth.ts","lineNumber":33,"sourceCode":"  return null;\n}\n\nexport function useRelayWorkspaceHostHealth(\n  hostId: string | null,\n): UseRelayWorkspaceHostHealthResult {\n  const hostHealthQuery = useQuery({\n    queryKey: [\"remote-workspaces-host-health\", hostId],\n    enabled: !!hostId,\n    retry: false,\n    staleTime: 5_000,\n    refetchInterval: 15_000,\n    queryFn: async (): Promise<true> => {\n      const response = await makeLocalApiRequest(\"/api/info\", {\n        cache: \"no-store\",\n      });\n\n      if (!response.ok) {\n        throw new Error(`Host returned HTTP ${response.status}`);\n      }\n\n      return true;\n    },\n  });\n\n  const isHostUnavailable =\n    hostHealthQuery.isError || hostHealthQuery.isRefetchError;\n\n  return {\n    isChecking: hostHealthQuery.isPending,\n    isError: isHostUnavailable,\n    errorMessage: isHostUnavailable\n      ? getErrorMessage(hostHealthQuery.error)\n      : null,\n  };\n}\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/remote-web/src/shared/hooks/useRelayWorkspaceHostHealth.ts#L15-L51","documentation":"This error is thrown by the useRelayWorkspaceHostHealth React Query hook when the polling health-check request to the local host's /api/info endpoint returns a non-OK HTTP status. The hook uses makeLocalApiRequest with cache:'no-store' to verify that the local (relay) workspace host is reachable and healthy; any non-2xx response (404, 500, 502, 503, etc.) is converted into this thrown Error so React Query marks the query as failed. It is the library's way of surfacing 'the local host is up enough to answer, but the info endpoint is failing'.","triggerScenarios":"The queryFn in useRelayWorkspaceHostHealth calls makeLocalApiRequest('/api/info', {cache:'no-store'}) and the response has response.ok === false — i.e. the local host HTTP server responded with a non-2xx status. This happens when the local backend process is starting up or crashing, the local backend port serves a proxy that returns 502/503, the /api/info route is missing (404) due to a version mismatch between remote-web and the local host, or a reverse proxy/auth layer rejects the request (401/403).","commonSituations":"Developer's local daemon is not running or crashed so the port is served by something else; local backend and remote server versions are out of sync so /api/info 404s; a dev proxy misroutes /api to the wrong port; local host is behind a firewall/proxy returning 502 Bad Gateway; machine going to sleep mid-session and the host coming back degraded.","solutions":["Check that the local host backend process is running and listening on the expected port (restart it if needed).","Open the /api/info URL directly in a browser or curl and note the returned HTTP status to identify 404 vs 5xx vs 401.","Verify the local host version matches the remote web version so the /api/info route exists (upgrade the CLI/local daemon).","If the status is 401/403, check any auth/token configuration between the browser and the local host.","Fix dev proxy configuration (VITE_API_BASE_URL / dev server proxy) so /api reaches the local backend.","Retry later or re-run the health check — React Query will refetch and clear the error once the host responds 2xx."],"exampleFix":"// before: host unreachable/degraded, version mismatch -> 404 from /api/info\n// old local daemon serving stale routes\n$ npx old-cli serve\n\n// after: update and restart the local host so /api/info returns 200\n$ npx latest-cli serve\n// hook then reports host healthy","handlingStrategy":"retry","validationCode":"// before polling health, check reachability yourself\nasync function isHostInfoReachable(): Promise<boolean> {\n  const res = await makeLocalApiRequest('/api/info', { cache: 'no-store' });\n  return res.ok;\n}","typeGuard":"function isHostHealthy(result: unknown): result is true {\n  return result === true;\n}","tryCatchPattern":"try {\n  const healthy = await queryClient.fetchQuery({ queryKey: ['hostHealth'], queryFn });\n  console.log('host healthy:', healthy);\n} catch (e) {\n  const status = (e as Error).message.match(/HTTP (\\d+)/)?.[1];\n  console.warn(`host unhealthy, status=${status ?? 'unknown'}; will retry on next refetch`);\n}","preventionTips":["Keep the local host daemon updated to a version that serves /api/info.","Verify the local backend is running before opening the remote workspace.","Check VITE_API_BASE_URL / proxy config so /api reaches the local backend.","Treat the health query as retryable and surface a 'reconnecting' UI instead of a hard failure.","Curl /api/info manually when the error appears to identify the status class (404 vs 5xx vs 401)."],"tags":["http","network","health-check","react-query"],"backgroundTag":"host-http-error","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}