TencentCloud/TencentDB-Agent-Memory · error

No adapter found for protocol "${metadata.protocol}"

Error message

No adapter found for protocol "${metadata.protocol}"

What it means

The injection pipeline maps a request's metadata.protocol (e.g. openai, anthropic) to a registered adapter via this.adapters.get(). When no adapter is registered for that protocol key, process throws immediately before parsing. This prevents unrecognized request formats from entering the pipeline.

Source

Thrown at MemoryProxy/src/injection/pipeline.ts:93

   *
   * @param body Raw request body (protocol-specific format)
   * @param metadata Request metadata
   * @returns Modified request body with injected content
   */
  async process(
    body: Record<string, unknown>,
    metadata: AgentContextMetadata,
  ): Promise<Record<string, unknown>> {
    const pipelineStartMs = Date.now();

    // ── Observer: pipeline start ─────────────────────────────────────────
    safeCall(() => this.observer.onPipelineStart(metadata));

    try {
      // 1. Get the appropriate adapter
      const adapter = this.adapters.get(metadata.protocol);
      if (!adapter) {
        throw new Error(
          `No adapter found for protocol "${metadata.protocol}"`,
        );
      }

      // 2. Parse → AgentContext
      const ctx: AgentContext = adapter.parse(body, metadata);

      // 2.5 Detect the agent profile.
      //     Priority: ① agentProfiles lookup by metadata.agentSource (URL path prefix),
      //               ② legacy detectAgent (system prompt content scanning, for un-prefixed paths).
      //     A matching Profile enables precise anchor landing; otherwise hooks fall
      //     back to coarse-grained `point` behavior.
      {
        let profile: AgentProfile | null = null;

        // ① Fast path: URL-path-based lookup (zero cost, no string scanning)
        if (this.agentProfiles) {
          profile = this.agentProfiles.get(metadata.agentSource) ?? null;

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Check the protocol value in the failing request and compare with the keys registered via pipeline.registerAdapter / the adapters map
  2. Fix the client/SDK configuration so it uses a supported protocol string
  3. Register an adapter for the protocol before processing requests
  4. Add startup validation that logs registered protocols to catch key mismatches early

Example fix

// before
pipeline.process(body, { protocol: "openai-chat" });
// after
pipeline.process(body, { protocol: "openai" }); // matches registered adapter key
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(pipeline.adapters.keys());
if (!SUPPORTED.has(metadata.protocol)) {
  throw new Error(`protocol '${metadata.protocol}' not supported; use one of: ${[...SUPPORTED].join(", ")}`);
}

Type guard

function hasAdapter(pipeline: Pipeline, protocol: string): boolean {
  return pipeline.adapters.has(protocol);
}

Prevention

When it happens

Trigger: Calling pipeline.process(body, metadata) where metadata.protocol is a string not present in the adapters map — e.g. typo'd protocol name, a new protocol used before registerAdapter, or protocol omitted/undefined.

Common situations: Clients pointing the proxy at an unsupported API surface (e.g. sending gemini-style payloads to an openai-only proxy); after upgrading the library, protocol key renamed (e.g. 'openai' -> 'openai-compat'); custom adapters not registered during bootstrap.

Related errors


AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/730a5866029d919a. Report an issue: GitHub.