vercel/ai · error

Invalid value: this hook only accepts values created via `cr

Error message

Invalid value: this hook only accepts values created via `createStreamableValue`.

What it means

useStreamableValue validates its argument through checkStreamableValue: anything that lacks the internal StreamableValue signature and is not undefined throws. The hook only works with values produced by createStreamableValue.

Source

Thrown at packages/rsc/src/streamable-value/use-streamable-value.tsx:10

import { startTransition, useLayoutEffect, useState } from 'react';
import { readStreamableValue } from './read-streamable-value';
import type { StreamableValue } from './streamable-value';
import { isStreamableValue } from './is-streamable-value';

function checkStreamableValue(value: unknown): value is StreamableValue {
  const hasSignature = isStreamableValue(value);

  if (!hasSignature && value !== undefined) {
    throw new Error(
      'Invalid value: this hook only accepts values created via `createStreamableValue`.',
    );
  }

  return hasSignature;
}

/**
 * `useStreamableValue` is a React hook that takes a streamable value created via the `createStreamableValue().value` API,
 * and returns the current value, error, and pending state.
 *
 * This is useful for consuming streamable values received from a component's props. For example:
 *
 * ```js
 * function MyComponent({ streamableValue }) {
 *   const [data, error, pending] = useStreamableValue(streamableValue);
 *
 *   if (pending) return <div>Loading...</div>;

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Pass the `.value` from createStreamableValue directly to the hook
  2. Do not serialize/deserialize StreamableValue before consumption
  3. Align AI SDK versions across server and client packages

Example fix

// before
useStreamableValue(somePromiseOrObject);
// after
const valueStream = createStreamableValue(0);
useStreamableValue(valueStream.value);
Defensive patterns

Strategy: type-guard

Validate before calling

import { isStreamableValue } from 'ai/rsc';
if (!isStreamableValue(candidate)) throw new TypeError('useStreamableValue requires createStreamableValue().value');

Type guard

function isStreamableValueLike(v: unknown): v is StreamableValue {
  return typeof v === 'object' && v !== null && 'type' in v && 'curr' in v;
}

Try / catch

try {
  const [value, error, pending] = useStreamableValue(input);
} catch (e) {
  if (e instanceof Error && e.message.includes('createStreamableValue')) {
    console.error('Invalid argument to useStreamableValue');
  }
}

Prevention

When it happens

Trigger: Calling useStreamableValue with a plain object, a raw Promise, or a value from a different stream API (e.g. createStreamableUI); passing a value deserialized/JSON-copied so the internal signature was lost.

Common situations: Confusing streamable UI chunks with streamable values; round-tripping the value through JSON storage before using the hook; mixed package versions between producer and consumer.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/6f85eb5a4cbe5b95. Report an issue: GitHub.