moeru-ai/airi · error · Error

prompt is required for image_journal.create

Error message

prompt is required for image_journal.create

What it means

Thrown by executeCreateImageJournalEntry when params.prompt is missing or whitespace-only after trim. The image_journal.create tool's JSON schema lists 'prompt' as required, but this runtime guard enforces it before any artistry call. The tool cannot proceed without a prompt to drive image generation.

Source

Thrown at apps/stage-tamagotchi/src/renderer/stores/tools/builtin/image-journal.ts:74

    mode: {
      type: ['string', 'null'],
      enum: ['inline', 'widget', 'bg', 'bg_widget', null],
      description: 'Display mode: "inline" (in chat), "widget" (overlay), "bg" (environment), or "bg_widget" (both). Defaults to character preference.',
    },
  },
  required: [
    'action',
    'prompt',
    'title',
    'query',
    'mode',
  ],
  additionalProperties: false,
} satisfies JsonSchema

async function executeCreateImageJournalEntry(params: { prompt?: string, title?: string, mode?: 'inline' | 'widget' | 'bg' | 'bg_widget' }) {
  if (!params.prompt?.trim())
    throw new Error('prompt is required for image_journal.create')

  const backgroundStore = useBackgroundStore()
  const cardStore = useAiriCardStore()
  const activeCard = cardStore.activeCard
  const globalArtistryConfig = getArtistryConfig()

  const airiExt = activeCard?.extensions?.airi
  const cardArtistry = airiExt?.modules?.artistry
  const artistryConfig = {
    provider: cardArtistry?.provider || globalArtistryConfig.provider,
    model: cardArtistry?.model || globalArtistryConfig.model,
    promptPrefix: cardArtistry?.promptPrefix || globalArtistryConfig.promptPrefix,
    options: cardArtistry?.options || globalArtistryConfig.options,
    globals: globalArtistryConfig.globals,
  }

  const title = params.title || `Generation ${new Date().toLocaleString()}`

View on GitHub (pinned to 27111382b4)

Solutions

  1. Ensure the tool-calling LLM always supplies a non-empty prompt argument.
  2. Add schema-level enforcement (the schema already requires 'prompt') so invalid calls are rejected before the executor.
  3. Surface a user-facing 'prompt is required' message and re-prompt the LLM.
  4. If invoking manually, pass a non-empty prompt string.

Example fix

// before
executeCreateImageJournalEntry({ prompt: '   ' })

// after
executeCreateImageJournalEntry({ prompt: 'a calm sunset over the sea' })
Defensive patterns

Strategy: validation

Validate before calling

function hasNonEmptyPrompt(params: { prompt?: string }): boolean {
  return typeof params.prompt === 'string' && params.prompt.trim().length > 0
}

Type guard

function isValidImageJournalPrompt(params: unknown): params is { prompt: string } {
  return typeof params === 'object' && params !== null
    && typeof (params as any).prompt === 'string'
    && (params as any).prompt.trim().length > 0
}

Prevention

When it happens

Trigger: The model/tool-caller invoked image_journal.create with an empty or omitted prompt; the prompt argument was passed as whitespace; schema validation upstream was bypassed.

Common situations: LLM emitted the tool call with an empty prompt string; prompt field omitted from the tool-call arguments JSON; UI/test harness called the executor directly with no prompt.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/41b661f63a3f8583. Report an issue: GitHub.