{"record":{"id":"66f31a0449209619","repo":"vercel/ai","slug":"functionality-functionality-not-supported","errorCode":null,"errorMessage":"'${functionality}' functionality not supported.","messagePattern":"'(.+?)' functionality not supported\\.","errorType":"exception","errorClass":"UnsupportedFunctionalityError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/generate-text/stream-text.ts","lineNumber":2897,"sourceCode":"        new TransformStream<\n          EnrichedStreamPart<TOOLS, InferPartialOutput<OUTPUT>>,\n          InferPartialOutput<OUTPUT>\n        >({\n          transform({ partialOutput }, controller) {\n            if (partialOutput != null) {\n              controller.enqueue(partialOutput);\n            }\n          },\n        }),\n      ),\n    );\n  }\n\n  get elementStream(): AsyncIterableStream<InferElementOutput<OUTPUT>> {\n    const transform = this.outputSpecification?.createElementStreamTransform();\n\n    if (transform == null) {\n      throw new UnsupportedFunctionalityError({\n        functionality: `element streams in ${\n          this.outputSpecification?.name ?? 'text'\n        } mode`,\n      });\n    }\n\n    return createAsyncIterableStream(this.teeStream().pipeThrough(transform));\n  }\n\n  private getOutputPromise(): Promise<InferCompleteOutput<OUTPUT>> {\n    if (this.outputPromise == null) {\n      this.outputPromise = this.finalStep.then(step => {\n        const output = this.outputSpecification ?? text();\n        return output.parseCompleteOutput(\n          { text: step.text },\n          {\n            response: step.response,\n            usage: step.usage,","sourceCodeStart":2879,"sourceCodeEnd":2915,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/generate-text/stream-text.ts#L2879-L2915","documentation":"streamText throws an UnsupportedFunctionalityError when you access the `elementStream` property but the configured output specification does not support element streams (its createElementStreamTransform returns null). Element streams are only available for output specifications that define per-element streaming (e.g. array/partial-object style outputs); in plain 'text' mode there is no element concept, so the stream cannot be created. The error names the mode so you can see which output configuration lacks the feature.","triggerScenarios":"Accessing `result.elementStream` on the DefaultStreamTextResult returned by streamText when no outputSpecification is set (default 'text' mode) or when using an output specification that does not implement createElementStreamTransform.","commonSituations":"Copying example code that iterates elementStream into a project that calls streamText without `experimental_output`/output configuration; using an output mode (e.g. plain text or object output) that predates or lacks element streaming support; upgrading the SDK and switching output specs without updating the consumption code.","solutions":["Configure streamText with an output specification that supports element streams (e.g. an array Output) before reading elementStream.","If you only need full text, read `result.textStream` instead of `result.elementStream`.","If you need a structured object (not streamed element-by-element), use `result.output`/object stream consumption instead of elementStream.","Check `this.outputSpecification`/mode at runtime and branch to the correct stream accessor."],"exampleFix":"// before\nconst result = streamText({ model, prompt });\nfor await (const element of result.elementStream) { ... }\n\n// after\nconst result = streamText({\n  model,\n  prompt,\n  experimental_output: Output.array(Output.string()),\n});\nfor await (const element of result.elementStream) { ... }","handlingStrategy":"validation","validationCode":"const supportsElements =\n  outputSpecification != null &&\n  typeof outputSpecification.createElementStreamTransform === 'function';\nif (!supportsElements) {\n  // consume result.textStream or result.output instead of elementStream\n}","typeGuard":"function supportsElementStream(spec: unknown): spec is { createElementStreamTransform: () => unknown } {\n  return (\n    typeof spec === 'object' && spec !== null &&\n    'createElementStreamTransform' in spec &&\n    typeof (spec as any).createElementStreamTransform === 'function'\n  );\n}","tryCatchPattern":"try {\n  for await (const el of result.elementStream) handle(el);\n} catch (error) {\n  if (UnsupportedFunctionalityError.isInstance(error)) {\n    for await (const text of result.textStream) handleText(text); // fallback\n  } else throw error;\n}","preventionTips":["Only access elementStream when you configured an element-capable output specification.","Gate stream selection on your own config flag, not on the result shape.","Add a unit test that exercises elementStream for every output mode you ship."],"tags":["streaming","unsupported-feature","configuration"],"backgroundTag":"unsupported-feature","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}