{"record":{"id":"b883ef04c31789c4","repo":"nexu-io/open-design","slug":"elevenlabs-kind-prompt-must-not-be-empty-pass","errorCode":null,"errorMessage":"ElevenLabs ${kind} prompt must not be empty. Pass --prompt before retrying.","messagePattern":"ElevenLabs (.+?) prompt must not be empty\\. Pass --prompt before retrying\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/index.ts","lineNumber":2555,"sourceCode":"const ELEVENLABS_SFX_MAX_PROMPT_CHARS = 450;\nconst ELEVENLABS_SFX_DEFAULT_PROMPT_INFLUENCE = 0.3;\n\nfunction clampElevenLabsSfxDuration(value: unknown): number {\n  if (typeof value !== 'number' || !Number.isFinite(value)) return 5;\n  return Math.min(30, Math.max(0.5, value));\n}\n\nfunction clampElevenLabsSfxPromptInfluence(value: unknown): number {\n  if (typeof value !== 'number' || !Number.isFinite(value)) {\n    return ELEVENLABS_SFX_DEFAULT_PROMPT_INFLUENCE;\n  }\n  return Math.min(1, Math.max(0, value));\n}\n\nfunction requireElevenLabsPrompt(text: string, kind: 'TTS' | 'SFX'): string {\n  const trimmed = text.trim();\n  if (!trimmed) {\n    throw new Error(`ElevenLabs ${kind} prompt must not be empty. Pass --prompt before retrying.`);\n  }\n  return trimmed;\n}\n\nfunction assertElevenLabsSfxPromptLength(text: string) {\n  const promptChars = Array.from(text).length;\n  if (promptChars > ELEVENLABS_SFX_MAX_PROMPT_CHARS) {\n    throw new Error(\n      `ElevenLabs SFX prompt exceeds ${ELEVENLABS_SFX_MAX_PROMPT_CHARS} characters (${promptChars}). Shorten --prompt before retrying.`,\n    );\n  }\n}\n\nasync function renderElevenLabsTTS(ctx: MediaContext, credentials: ProviderConfig): Promise<RenderResult> {\n  if (!credentials.apiKey) {\n    throw new Error(\n      'no ElevenLabs API key - configure it in Settings or set OD_ELEVENLABS_API_KEY',\n    );","sourceCodeStart":2537,"sourceCodeEnd":2573,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/index.ts#L2537-L2573","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-empty --prompt (or ctx.prompt) before retrying","Validate prompt length at the caller before invoking the render path","If building prompts programmatically, guard against empty results from the prompt-generation step"],"exampleFix":"// before\nrenderElevenLabsTTS({ prompt: '   ', wireModel: 'eleven_v3' }, creds);\n// after\nrenderElevenLabsTTS({ prompt: 'Hello world', wireModel: 'eleven_v3' }, creds);","handlingStrategy":"validation","validationCode":"function hasNonEmptyPrompt(text: string | undefined | null): text is string {\n  return typeof text === 'string' && text.trim().length > 0;\n}\n\nif (!hasNonEmptyPrompt(ctx.prompt)) {\n  throw new Error('ElevenLabs render requires a non-empty --prompt');\n}","typeGuard":"function isValidElevenLabsInput(ctx: unknown): ctx is { prompt: string } {\n  return typeof ctx === 'object' && ctx !== null\n    && typeof (ctx as { prompt?: unknown }).prompt === 'string'\n    && (ctx as { prompt: string }).prompt.trim().length > 0;\n}","tryCatchPattern":"try {\n  const prompt = requireElevenLabsPrompt(ctx.prompt, kind);\n} catch (err) {\n  if (err instanceof Error && /ElevenLabs .* prompt must not be empty/.test(err.message)) {\n    // collect a prompt from the user and retry\n  } else throw err;\n}","preventionTips":["Validate prompt non-emptiness at the UI/agent boundary, not just inside the render function","For programmatic prompt generation, fail the upstream step rather than passing an empty string downstream","Mirror the same empty-check for SFX prompts since requireElevenLabsPrompt covers both kinds"],"tags":["elevenlabs","tts","sfx","validation","input"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}