{"record":{"id":"1aa3f3fd3f750fba","repo":"mem0ai/mem0","slug":"streaming-failed-or-method-not-implemented","errorCode":null,"errorMessage":"Streaming failed or method not implemented.","messagePattern":"Streaming failed or method not implemented\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"integrations/vercel-ai-sdk/src/mem0-generic-language-model.ts","lineNumber":167,"sourceCode":"        ...this.settings,\n      }\n\n      const selector = new Mem0ClassSelector(this.modelId, settings, this.provider_config);\n\n      const { messagesPrompts: updatedPrompts } = await this.processMemories(options.prompt, mem0Config);\n\n      const baseModel = selector.createProvider();\n\n      const streamResponse = await baseModel.doStream({\n        ...options,\n        prompt: updatedPrompts,\n      });\n\n      // Return the full stream response, preserving all V3 fields (warnings, etc.)\n      return streamResponse;\n    } catch (error) {\n      console.error(\"Error in doStream:\", error);\n      throw new Error(\"Streaming failed or method not implemented.\");\n    }\n  }\n}\n","sourceCodeStart":149,"sourceCodeEnd":171,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/integrations/vercel-ai-sdk/src/mem0-generic-language-model.ts#L149-L171","documentation":"Thrown by the doStream() wrapper in mem0-generic-language-model.ts, this error is a catch-all that replaces ANY failure from the underlying provider's doStream() call — network errors, auth failures, invalid prompts, or a provider whose LanguageModelV3 implementation genuinely lacks streaming. The original error is logged via console.error first, then discarded, so the thrown message carries no root-cause detail.","triggerScenarios":"Streaming text generation via generateText/streamText through the Mem0-wrapped model, where baseModel.doStream() throws: bad/expired provider API key, model ID not found, rate limit, malformed prompt, an unsupported provider_config, or a provider class without a doStream implementation.","commonSituations":"Wrong apiKey in provider settings; passing a chat-only or completion-only model into a streaming call; a provider_config shape the target provider rejects; transient 429/5xx from the upstream LLM; upgrading @ai-sdk/* majors where the stream interface changed.","solutions":["Read the console.error('Error in doStream:', error) output immediately above the throw — the real cause is only visible there.","Verify provider API key, model ID, and provider_config passed to the Mem0 provider factory.","Confirm the underlying provider package supports streaming for the chosen model (test the raw provider's doStream directly).","Patch the wrapper to rethrow the original error (throw error) or chain it (new Error(msg, { cause: error })) so callers can branch on it.","Add retry with backoff around streamText for transient 429/5xx responses."],"exampleFix":"// before (mem0-generic-language-model.ts)\n} catch (error) {\n  console.error(\"Error in doStream:\", error);\n  throw new Error(\"Streaming failed or method not implemented.\");\n}\n\n// after\n} catch (error) {\n  throw new Error(`Streaming failed: ${(error as Error).message}`, { cause: error });\n}","handlingStrategy":"try-catch","validationCode":"import { streamText } from 'ai';\n\n// smoke-test the underlying provider once at startup\nawait streamText({ model: mem0Model, prompt: 'ping' }).consumeStream();","typeGuard":"const isMem0StreamError = (e: unknown): boolean =>\n  e instanceof Error && e.message.startsWith('Streaming failed');","tryCatchPattern":"try {\n  const r = await streamText({ model: mem0Model, prompt });\n} catch (e) {\n  if (isMem0StreamError(e)) {\n    // real cause is lost; check server logs for the console.error line, then retry once\n    return retryOnce(() => streamText({ model: mem0Model, prompt }));\n  }\n  throw e;\n}","preventionTips":["Verify provider apiKey/modelId with a one-shot generateText before wiring streaming.","Patch or fork the wrapper to chain the original error via { cause } so your handlers can branch on status codes.","Keep @ai-sdk/* package versions aligned with the integration's peer requirements."],"tags":["streaming","vercel-ai-sdk","error-masking","llm-provider"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}