{"record":{"id":"8b56b302fd0600ba","repo":"ruvnet/ruflo","slug":"unknown-transport-type-type","errorCode":null,"errorMessage":"Unknown transport type: ${type}","messagePattern":"Unknown transport type: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/mcp/src/transport/index.ts","lineNumber":64,"sourceCode":"        port: config.port as number,\n        ...config,\n      } 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      return createInProcessTransport(logger);\n\n    default:\n      throw new Error(`Unknown transport type: ${type}`);\n  }\n}\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> {\n    this.logger.debug('In-process transport stopped');\n  }\n\n  onRequest(): void {\n    // No-op - requests are handled directly","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/mcp/src/transport/index.ts#L46-L82","documentation":"createTransport() switches on the TransportType union ('stdio' | 'http' | 'websocket' | 'in-process'); any other value falls into the default branch and throws 'Unknown transport type: <type>'. TypeScript rejects invalid literals at compile time, so seeing this at runtime means an unchecked string reached the factory — via a cast, a JS caller, or config/env input.","triggerScenarios":"Reading the transport name from an env var, CLI flag, or config file (e.g. TRANSPORT=ws instead of 'websocket'); casting with `as TransportType`; legacy aliases like 'sse' or 'Websocket' from an older version or different casing.","commonSituations":"Deploying with a config written for an older CLI vocabulary; case/casing mismatches in docker-compose or Kubernetes env vars; string interpolation assembling the type name.","solutions":["Use one of the exact literals: 'stdio', 'http', 'websocket', 'in-process'","Map external names/aliases to the union at the boundary (e.g. ws -> 'websocket')","Validate the value against an allowlist before calling createTransport and fail fast","Keep a typed constant instead of a raw string flowing from config"],"exampleFix":"// before\nconst t = createTransport(process.env.TRANSPORT as TransportType, logger, cfg);\n\n// after\nconst ALIASES: Record<string, TransportType> = {\n  stdio: 'stdio', http: 'http', ws: 'websocket', websocket: 'websocket', 'in-process': 'in-process',\n};\nconst type = ALIASES[(process.env.TRANSPORT ?? '').toLowerCase()];\nif (!type) throw new Error(`Invalid TRANSPORT=${process.env.TRANSPORT}. Use stdio|http|websocket|in-process`);\nconst t = createTransport(type, logger, cfg);","handlingStrategy":"type-guard","validationCode":"const TRANSPORT_TYPES = ['stdio', 'http', 'websocket', 'in-process'] as const;\nconst raw = (process.env.TRANSPORT ?? 'stdio').toLowerCase();\nif (!(TRANSPORT_TYPES as readonly string[]).includes(raw)) {\n  throw new Error(`Invalid transport '${raw}'. Use: ${TRANSPORT_TYPES.join('|')}`);\n}\nconst t = createTransport(raw as TransportType, logger, cfg);","typeGuard":"const TRANSPORT_TYPES = ['stdio', 'http', 'websocket', 'in-process'] as const;\nfunction isTransportType(v: unknown): v is (typeof TRANSPORT_TYPES)[number] {\n  return typeof v === 'string' && (TRANSPORT_TYPES as readonly string[]).includes(v);\n}","tryCatchPattern":null,"preventionTips":["Never cast unchecked strings to TransportType","Centralize an alias map (ws -> websocket, etc.) at the config boundary and fail fast","Keep the allowlist in sync with the library's TransportType union on upgrades"],"tags":["transport","enum","configuration","factory"],"backgroundTag":"invalid-enum-value","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}