{"record":{"id":"01968c7718a8780d","repo":"langflow-ai/langflow","slug":"failed-to-reload-bundle","errorCode":null,"errorMessage":"Failed to reload bundle","messagePattern":"Failed to reload bundle","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/frontend/src/controllers/API/queries/extensions/use-reload-bundle.ts","lineNumber":85,"sourceCode":"        typeof detail === \"object\" &&\n        (detail as ReloadInProgressDetail).code === \"reload-in-progress\"\n      ) {\n        const inProgress = detail as ReloadInProgressDetail;\n        throw new Error(`reload-in-progress: ${inProgress.message}`);\n      }\n\n      // 422 carries the full ReloadResult in detail.result so structural\n      // failures keep the same body shape as a 200 -- the caller's\n      // onSuccess handler renders the typed errors inline via the\n      // existing ok=false branch.\n      if (status === 422 && detail && typeof detail === \"object\") {\n        const result = (detail as { result?: ReloadBundleResponse }).result;\n        if (result && typeof result === \"object\") {\n          return result;\n        }\n      }\n\n      throw new Error(\n        extractApiErrorMessage(\n          error as Parameters<typeof extractApiErrorMessage>[0],\n          \"Failed to reload bundle\",\n        ),\n      );\n    }\n  }\n\n  const mutation: UseMutationResult<\n    ReloadBundleResponse,\n    Error,\n    ReloadBundleVariables\n  > = mutate([\"useReloadBundle\"], reloadBundle, options);\n\n  return mutation;\n};\n","sourceCodeStart":67,"sourceCodeEnd":102,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/frontend/src/controllers/API/queries/extensions/use-reload-bundle.ts#L67-L102","documentation":"500 raised inside the PATCH handler when starting MCP Composer for OAuth throws an unexpected (non-MCPComposerError) exception. The handler deliberately rolls back project.auth_settings to the pre-request value before failing, so the DB stays consistent, and echoes the raw exception text.","triggerScenarios":"PATCH /api/v1/mcp/projects/{project_id} with auth_type='oauth' while mcp_composer_enabled=True, and get_or_start_mcp_composer raises e.g. a subprocess spawn error (uvx missing), port allocation failure, or an httpx connection error.","commonSituations":"uv not installed / uvx not on PATH in the container; composer port already in use by a zombie process; first-run image missing the mcp-composer package; OAuth host/port misconfigured.","solutions":["Check the aerror log line 'Unexpected error starting MCP Composer ... rolling back auth settings' for the underlying exception.","Verify 'uvx --version' works in the Langflow runtime environment and that the mcp-composer version pin (settings.mcp_composer_version) resolves.","Ensure the composer host/port in auth settings is free and reachable.","Retry the PATCH after fixing the environment — the rollback means no state cleanup is needed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import shutil\nif shutil.which(\"uvx\") is None:\n    raise EnvironmentError(\"uvx not on PATH; MCP Composer cannot start\")","typeGuard":null,"tryCatchPattern":"try:\n    await client.patch(project_url, json={\"auth_type\": \"oauth\", ...})\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 500:\n        detail = e.response.json().get(\"detail\", \"\")\n        # auth settings were rolled back server-side; safe to fix env and retry","preventionTips":["Verify uvx and the pinned mcp-composer version work before enabling OAuth on projects.","Reserve a known-free host/port for the composer.","Remember the rollback: after this 500 the previous auth settings are still active, so retrying is idempotent."],"tags":["mcp","mcp-composer","oauth","http-500"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}