BloopAI/vibe-kanban · error · Error

Machine client is required

Error message

Machine client is required

What it means

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.

Source

Thrown at packages/web-core/src/shared/dialogs/settings/settings/McpSettingsSection.tsx:78

  }, [config?.executor_profile, profiles, selectedProfile]);

  // Load MCP configuration when selected profile changes
  useEffect(() => {
    const loadMcpServersForProfile = async (profile: ExecutorProfile) => {
      setMcpLoading(true);
      setMcpError(null);
      setMcpConfigPath('');

      try {
        const profileKey = profiles
          ? Object.keys(profiles).find((key) => profiles[key] === profile)
          : null;
        if (!profileKey) {
          throw new Error('Profile key not found');
        }

        if (!machineClient) {
          throw new Error('Machine client is required');
        }

        const result = await machineClient.loadMcpServers({
          executor: profileKey as BaseCodingAgent,
        });
        setMcpConfig(result.mcp_config);
        const fullConfig = McpConfigStrategyGeneral.createFullConfig(
          result.mcp_config
        );
        const configJson = JSON.stringify(fullConfig, null, 2);
        setMcpServers(configJson);
        setOriginalMcpServers(configJson);
        setMcpConfigPath(result.config_path);
      } catch (err: unknown) {
        if (
          err instanceof Error &&
          err.message.includes('does not support MCP')
        ) {

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Select/connect a machine in settings before using the MCP section, or render the section only when useSettingsMachineClient() is non-null
  2. Verify the component tree wraps settings in SettingsHostContext.Provider with a machine client
  3. Gate the load effect on machineClient (include it in deps and return early if null) instead of throwing
  4. If in a remote setup, ensure the backend connection providing the machine client is established

Example fix

// before
if (!machineClient) {
  throw new Error('Machine client is required');
}
// after
if (!machineClient) {
  setMcpError('Select a machine to load MCP servers');
  return;
}
Defensive patterns

Strategy: fallback

Validate before calling

// component-level guard before rendering the MCP section:
const machineClient = useSettingsMachineClient();
if (!machineClient) return <EmptyState message="Select a machine to manage MCP servers" />;

Type guard

function hasMachineClient(c: MachineClient | null | undefined): c is MachineClient {
  return c != null && typeof c.loadMcpServers === 'function';
}

Try / catch

try {
  if (!machineClient) {
    setMcpError('No machine selected — MCP servers cannot be loaded.');
    return; // fallback UI shows a machine picker
  }
  const result = await machineClient.loadMcpServers({ executor: profileKey as BaseCodingAgent });
} catch (err) {
  setMcpError(err instanceof Error ? err.message : t('settings.mcp.errors.loadFailed'));
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/eab66a6772ca4d62. Report an issue: GitHub.