nexu-io/open-design · error · Error

ElevenLabs ${kind} prompt must not be empty. Pass --prompt b

Error message

ElevenLabs ${kind} prompt must not be empty. Pass --prompt before retrying.

What it means

Thrown by requireElevenLabsPrompt() when the prompt text is empty after trimming. ElevenLabs TTS and SFX both require non-empty input text; the guard fires before any network call. The message names the kind (TTS or SFX) and tells the caller to pass --prompt.

Source

Thrown at apps/daemon/src/media/index.ts:2555

const ELEVENLABS_SFX_MAX_PROMPT_CHARS = 450;
const ELEVENLABS_SFX_DEFAULT_PROMPT_INFLUENCE = 0.3;

function clampElevenLabsSfxDuration(value: unknown): number {
  if (typeof value !== 'number' || !Number.isFinite(value)) return 5;
  return Math.min(30, Math.max(0.5, value));
}

function clampElevenLabsSfxPromptInfluence(value: unknown): number {
  if (typeof value !== 'number' || !Number.isFinite(value)) {
    return ELEVENLABS_SFX_DEFAULT_PROMPT_INFLUENCE;
  }
  return Math.min(1, Math.max(0, value));
}

function requireElevenLabsPrompt(text: string, kind: 'TTS' | 'SFX'): string {
  const trimmed = text.trim();
  if (!trimmed) {
    throw new Error(`ElevenLabs ${kind} prompt must not be empty. Pass --prompt before retrying.`);
  }
  return trimmed;
}

function assertElevenLabsSfxPromptLength(text: string) {
  const promptChars = Array.from(text).length;
  if (promptChars > ELEVENLABS_SFX_MAX_PROMPT_CHARS) {
    throw new Error(
      `ElevenLabs SFX prompt exceeds ${ELEVENLABS_SFX_MAX_PROMPT_CHARS} characters (${promptChars}). Shorten --prompt before retrying.`,
    );
  }
}

async function renderElevenLabsTTS(ctx: MediaContext, credentials: ProviderConfig): Promise<RenderResult> {
  if (!credentials.apiKey) {
    throw new Error(
      'no ElevenLabs API key - configure it in Settings or set OD_ELEVENLABS_API_KEY',
    );

View on GitHub (pinned to 5be4028344)

Solutions

  1. Pass a non-empty --prompt (or ctx.prompt) before retrying
  2. Validate prompt length at the caller before invoking the render path
  3. If building prompts programmatically, guard against empty results from the prompt-generation step

Example fix

// before
renderElevenLabsTTS({ prompt: '   ', wireModel: 'eleven_v3' }, creds);
// after
renderElevenLabsTTS({ prompt: 'Hello world', wireModel: 'eleven_v3' }, creds);
Defensive patterns

Strategy: validation

Validate before calling

function hasNonEmptyPrompt(text: string | undefined | null): text is string {
  return typeof text === 'string' && text.trim().length > 0;
}

if (!hasNonEmptyPrompt(ctx.prompt)) {
  throw new Error('ElevenLabs render requires a non-empty --prompt');
}

Type guard

function isValidElevenLabsInput(ctx: unknown): ctx is { prompt: string } {
  return typeof ctx === 'object' && ctx !== null
    && typeof (ctx as { prompt?: unknown }).prompt === 'string'
    && (ctx as { prompt: string }).prompt.trim().length > 0;
}

Try / catch

try {
  const prompt = requireElevenLabsPrompt(ctx.prompt, kind);
} catch (err) {
  if (err instanceof Error && /ElevenLabs .* prompt must not be empty/.test(err.message)) {
    // collect a prompt from the user and retry
  } else throw err;
}

Prevention

When it happens

Trigger: Invoking ElevenLabs TTS or SFX render with an empty, whitespace-only, or undefined ctx.prompt. Common when an agent omits --prompt or a UI sends an empty text field.

Common situations: Agent forgot to include --prompt in the media command; UI prompt field left blank; prompt was passed via the wrong parameter name; upstream prompt generation produced an empty string.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/b883ef04c31789c4. Report an issue: GitHub.