ruvnet/ruflo · error · Error

IoT Cognitum not initialized

Error message

IoT Cognitum not initialized

What it means

MCP twin of the CLI guard: every iot_* MCP tool obtains its IoTCoordinator via requireCoordinator(), which throws when the plugin's coordinator is null — the IoT Cognitum plugin has not completed initialization/registration in this host. It fires before any tool logic runs.

Source

Thrown at v3/@claude-flow/plugin-iot-cognitum/src/mcp-tools.ts:18

import type { MCPToolDefinition } from '@claude-flow/shared/src/plugin-interface.js';
import type { PluginContext } from '@claude-flow/shared/src/plugin-interface.js';
import type { IoTCoordinator } from './application/iot-coordinator.js';

type CoordinatorGetter = () => IoTCoordinator | null;
type ContextGetter = () => PluginContext | null;

function textResult(text: string, isError = false) {
  return { content: [{ type: 'text' as const, text }], isError };
}

export function createMcpTools(
  getCoordinator: CoordinatorGetter,
  _getContext: ContextGetter,
): MCPToolDefinition[] {
  function requireCoordinator(): IoTCoordinator {
    const c = getCoordinator();
    if (!c) throw new Error('IoT Cognitum not initialized');
    return c;
  }

  return [
    // -- Device lifecycle ----------------------------------------------------
    {
      name: 'iot_device_register',
      description: 'Register a Cognitum Seed device by endpoint',
      pluginName: '@claude-flow/plugin-iot-cognitum',
      version: '1.0.0-alpha.1',
      inputSchema: {
        type: 'object',
        properties: {
          endpoint: { type: 'string', description: 'Device HTTP endpoint (e.g. http://169.254.42.1)' },
          pairingToken: { type: 'string', description: 'Optional pairing token for mutual auth' },
        },
        required: ['endpoint'],
      },

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Complete the plugin's initialization/registration flow (the iot register path) before invoking iot_* tools
  2. Inspect host and plugin startup logs for a failed IoTCoordinator construction and fix it
  3. Retry the tool call after initialization succeeds

Example fix

// before
await client.callTool('iot_device_register', { endpoint }); // throws 'IoT Cognitum not initialized'

// after
await client.callTool('iot_init', {}); // plugin bootstrap
await runIotRegister(); // registration flow completes coordinator setup
await client.callTool('iot_device_register', { endpoint });
Defensive patterns

Strategy: validation

Validate before calling

const ready = await pluginHost.waitForReady('@claude-flow/plugin-iot-cognitum');
if (!ready) {
  throw new Error('IoT plugin not ready; blocking iot_* tool calls');
}
await client.callTool('iot_device_register', { endpoint });

Try / catch

try {
  await client.callTool('iot_device_register', { endpoint });
} catch (e) {
  if (e instanceof Error && e.message === 'IoT Cognitum not initialized') {
    await bootstrapIotPlugin(); // init + register, then retry once
    await client.callTool('iot_device_register', { endpoint });
  } else throw e;
}

Prevention

When it happens

Trigger: An MCP client (agent or test harness) invoking iot_device_register or any other iot_* tool before the plugin's init/registration flow ran, or after it failed, leaving getCoordinator() null.

Common situations: LLM agents discovering the tools and calling them out of order; plugin init failed at host startup (bad config, unreachable endpoint) so the coordinator was never set; tools invoked while async initialization is still in flight.

Related errors


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/0101505b108fd64c. Report an issue: GitHub.