{"record":{"id":"a2d0262dc7ae61c5","repo":"different-ai/openwork","slug":"failed-to-start-github-install-response-status","errorCode":null,"errorMessage":"Failed to start GitHub install (${response.status}).","messagePattern":"Failed to start GitHub install \\((.+?)\\)\\.","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/integration-data.tsx","lineNumber":421,"sourceCode":"export function useStartGithubInstall() {\n  const queryClient = useQueryClient();\n  const { runReauthableAction } = useOrgDashboard();\n\n  return useMutation({\n    mutationFn: async (input: { returnPath: string }): Promise<GithubInstallStartResult> => {\n      let result: GithubInstallStartResult | null = null;\n      await runReauthableAction(\"start-github-install\", async () => {\n      const { response, payload } = await requestJson(\n        \"/v1/connectors/github/install/start\",\n        {\n          method: \"POST\",\n          body: JSON.stringify({ returnPath: input.returnPath }),\n        },\n        15000,\n      );\n\n      if (!response.ok) {\n        throw getRequestError(payload, response, `Failed to start GitHub install (${response.status}).`);\n      }\n\n      const item = isRecord(payload) && isRecord(payload.item) ? payload.item : null;\n      const redirectUrl = item ? asString(item.redirectUrl) : null;\n      const state = item ? asString(item.state) : null;\n      if (!redirectUrl || !state) {\n        throw new Error(\"GitHub install start response was incomplete.\");\n      }\n\n        result = { redirectUrl, state };\n      });\n      if (!result) {\n        throw new Error(\"GitHub install start response was incomplete.\");\n      }\n      return result;\n    },\n    onSuccess: () => {\n      queryClient.invalidateQueries({ queryKey: integrationQueryKeys.all });","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/integration-data.tsx#L403-L439","documentation":"Thrown by useStartGithubInstall when POST /v1/connectors/github/install (returnPath payload) returns non-OK. getRequestError throws ReauthRequiredError for 403 reauth payloads or the server message / this fallback otherwise. It means the server could not initiate the GitHub App installation flow (no redirectUrl/state issued).","triggerScenarios":"POST /v1/connectors/github/install fails: GitHub App not configured on the Den server (missing App ID/private key), insufficient permissions (401/403), invalid returnPath, or 5xx. 15s timeout.","commonSituations":"Self-hosted Den with GitHub connector env vars missing; workspace needing reauth; clicking 'Install GitHub' before the connector was provisioned; blocked by org policy restricting connectors.","solutions":["Check the surfaced server message; configure GitHub App credentials (App ID, private key, webhook secret) on the Den server if missing.","Re-authenticate on reauth-required errors and retry.","Verify the user has permission to manage connectors for the org.","Ensure returnPath is a valid in-app route; use a relative path.","Check server logs for connector provisioning errors on 5xx."],"exampleFix":"// before\nif (!response.ok) {\n  throw getRequestError(payload, response, `Failed to start GitHub install (${response.status}).`);\n}\n// after\nif (!response.ok) {\n  const err = getRequestError(payload, response, `Failed to start GitHub install (${response.status}).`);\n  if (isReauthRequiredError(err)) { redirectToReauth(); return; }\n  throw err;\n}","handlingStrategy":"try-catch","validationCode":"if (!githubAppConfigured) return; // server reports connector availability via capabilities/status\nif (typeof input.returnPath !== \"string\" || !input.returnPath.startsWith(\"/\")) return; // relative path only","typeGuard":"function isReauth(error: unknown): error is ReauthRequiredError { return error instanceof ReauthRequiredError; }","tryCatchPattern":"try {\n  await startGithubInstall({ returnPath });\n} catch (error) {\n  if (isReauthRequiredError(error)) { promptReauth(); return; }\n  setConnectError(error instanceof Error ? error.message : \"Could not start GitHub install.\");\n}","preventionTips":["Confirm the GitHub connector is configured on the Den server before showing the install CTA","Always send a relative returnPath","Wrap in reauth-aware action so 403 reauth retries","Hide the button for users lacking connector permissions"],"tags":["http","github","integration","network"],"backgroundTag":"github-app-install-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}