{"record":{"id":"eab66a6772ca4d62","repo":"BloopAI/vibe-kanban","slug":"machine-client-is-required","errorCode":null,"errorMessage":"Machine client is required","messagePattern":"Machine client is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/dialogs/settings/settings/McpSettingsSection.tsx","lineNumber":78,"sourceCode":"  }, [config?.executor_profile, profiles, selectedProfile]);\n\n  // Load MCP configuration when selected profile changes\n  useEffect(() => {\n    const loadMcpServersForProfile = async (profile: ExecutorProfile) => {\n      setMcpLoading(true);\n      setMcpError(null);\n      setMcpConfigPath('');\n\n      try {\n        const profileKey = profiles\n          ? Object.keys(profiles).find((key) => profiles[key] === profile)\n          : null;\n        if (!profileKey) {\n          throw new Error('Profile key not found');\n        }\n\n        if (!machineClient) {\n          throw new Error('Machine client is required');\n        }\n\n        const result = await machineClient.loadMcpServers({\n          executor: profileKey as BaseCodingAgent,\n        });\n        setMcpConfig(result.mcp_config);\n        const fullConfig = McpConfigStrategyGeneral.createFullConfig(\n          result.mcp_config\n        );\n        const configJson = JSON.stringify(fullConfig, null, 2);\n        setMcpServers(configJson);\n        setOriginalMcpServers(configJson);\n        setMcpConfigPath(result.config_path);\n      } catch (err: unknown) {\n        if (\n          err instanceof Error &&\n          err.message.includes('does not support MCP')\n        ) {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/dialogs/settings/settings/McpSettingsSection.tsx#L60-L96","documentation":"loadMcpServersForProfile throws 'Machine client is required' when useSettingsMachineClient() returned null/undefined, so machineClient.loadMcpServers cannot be called. The machine client is only available when the settings page is bound to a machine/host; without it no MCP config can be loaded.","triggerScenarios":"The MCP-load effect runs while the settings host context has no machine client (no machine selected / machine-scoped context not yet mounted), i.e. useSettingsMachineClient() yields null when the effect fires.","commonSituations":"Opening MCP settings before a machine is selected in a multi-machine setup; SettingsHostContext provider missing or not yet hydrated; component rendered outside the machine-scoped provider during navigation.","solutions":["Select/connect a machine in settings before using the MCP section, or render the section only when useSettingsMachineClient() is non-null","Verify the component tree wraps settings in SettingsHostContext.Provider with a machine client","Gate the load effect on machineClient (include it in deps and return early if null) instead of throwing","If in a remote setup, ensure the backend connection providing the machine client is established"],"exampleFix":"// before\nif (!machineClient) {\n  throw new Error('Machine client is required');\n}\n// after\nif (!machineClient) {\n  setMcpError('Select a machine to load MCP servers');\n  return;\n}","handlingStrategy":"fallback","validationCode":"// component-level guard before rendering the MCP section:\nconst machineClient = useSettingsMachineClient();\nif (!machineClient) return <EmptyState message=\"Select a machine to manage MCP servers\" />;","typeGuard":"function hasMachineClient(c: MachineClient | null | undefined): c is MachineClient {\n  return c != null && typeof c.loadMcpServers === 'function';\n}","tryCatchPattern":"try {\n  if (!machineClient) {\n    setMcpError('No machine selected — MCP servers cannot be loaded.');\n    return; // fallback UI shows a machine picker\n  }\n  const result = await machineClient.loadMcpServers({ executor: profileKey as BaseCodingAgent });\n} catch (err) {\n  setMcpError(err instanceof Error ? err.message : t('settings.mcp.errors.loadFailed'));\n}","preventionTips":["Render machine-dependent sections only inside SettingsHostContext with a bound client","Disable the MCP section while no machine is selected","Initialize the machine client before mounting settings tabs","In multi-machine setups, keep a persisted default machine selection"],"tags":["react","context","client-init"],"backgroundTag":"missing-machine-client","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}