{"record":{"id":"7d916b797636ac2e","repo":"ruvnet/ruflo","slug":"unknown-transport-type-type-7d916b","errorCode":null,"errorMessage":"Unknown transport type: ${type}","messagePattern":"Unknown transport type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/shared/src/mcp/transport/index.ts","lineNumber":84,"sourceCode":"      } as HttpTransportConfig);\n\n    case 'websocket':\n      if (!config || !('host' in config) || !('port' in config)) {\n        throw new Error('WebSocket transport requires host and port configuration');\n      }\n      return createWebSocketTransport(logger, {\n        host: config.host as string,\n        port: config.port as number,\n        ...config,\n      } as WebSocketTransportConfig);\n\n    case 'in-process':\n      // In-process transport is handled directly by the server\n      // Return a no-op transport wrapper\n      return createInProcessTransport(logger);\n\n    default:\n      throw new Error(`Unknown transport type: ${type}`);\n  }\n}\n\n/**\n * In-process transport (no-op wrapper)\n *\n * Used when tools are executed directly without network transport\n */\nclass InProcessTransport implements ITransport {\n  public readonly type: TransportType = 'in-process';\n\n  constructor(private readonly logger: ILogger) {}\n\n  async start(): Promise<void> {\n    this.logger.debug('In-process transport started');\n  }\n\n  async stop(): Promise<void> {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/shared/src/mcp/transport/index.ts#L66-L102","documentation":"createTransport switches over the TransportType union - 'stdio', 'http', 'websocket', 'in-process' - and the default arm throws 'Unknown transport type: ${type}' for anything else. When the argument is a checked literal, TypeScript makes this unreachable; the throw is hit with dynamically-typed input (strings from env vars, CLI flags, JSON/YAML config) containing a typo, wrong casing, or a name removed/renamed across versions.","triggerScenarios":"createTransport(process.env.MCP_TRANSPORT as TransportType, ...) where the value is 'HTTP' (case-sensitive switch) or 'tcp'; config YAML with 'socket' instead of 'stdio'; stale config still naming a transport type that a newer library version removed or renamed; JSON parsed as any and passed through unchecked.","commonSituations":"Env/CLI-driven transport selection without normalization; config files authored against an older release; casing mismatches like 'WebSocket' vs 'websocket'; users guessing supported values with no up-front validation.","solutions":["Normalize then validate before the call: trim().toLowerCase() and check membership in ['stdio','http','websocket','in-process'], failing with a message listing valid values","Fix the typo/casing at the config source","If the name came from an upgrade, check the changelog and migrate to a supported transport type"],"exampleFix":"// before\nconst type = process.env.MCP_TRANSPORT as TransportType; // 'HTTP'\nconst t = createTransport(type, logger, cfg); // throws: Unknown transport type: HTTP\n\n// after\nconst TYPES = ['stdio', 'http', 'websocket', 'in-process'] as const;\nconst raw = (process.env.MCP_TRANSPORT ?? 'stdio').trim().toLowerCase();\nif (!TYPES.includes(raw as any)) {\n  throw new Error(`Unsupported transport '${raw}'. Supported: ${TYPES.join(', ')}`);\n}\nconst t = createTransport(raw as TransportType, logger, cfg);","handlingStrategy":"type-guard","validationCode":"const raw = (source as string | undefined)?.trim().toLowerCase();\nif (!isTransportType(raw)) {\n  throw new Error(`Unsupported transport '${raw}'. Supported: ${TRANSPORT_TYPES.join(', ')}`);\n}\nreturn createTransport(raw, logger, config);","typeGuard":"const TRANSPORT_TYPES = ['stdio', 'http', 'websocket', 'in-process'] as const;\ntype TransportType = typeof TRANSPORT_TYPES[number];\nfunction isTransportType(v: unknown): v is TransportType {\n  return typeof v === 'string' && (TRANSPORT_TYPES as readonly string[]).includes(v);\n}","tryCatchPattern":"try {\n  return createTransport(type as TransportType, logger, config);\n} catch (e) {\n  if (e instanceof Error && /Unknown transport type/.test(e.message)) {\n    console.error(`Supported transports: ${TRANSPORT_TYPES.join(', ')}`);\n    process.exit(2); // config error: fail fast with guidance\n  }\n  throw e;\n}","preventionTips":["Never cast external strings to TransportType without a membership check","Normalize (trim + lowercase) user-supplied transport names before validating","Validate at config-load time with the supported list, not deep inside the factory"],"tags":["mcp","transport","factory","invalid-input","configuration"],"backgroundTag":"unsupported-transport-type","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}