moeru-ai/airi · error · Error

Missing LLM configuration

Error message

Missing LLM configuration (Model: ${modelId}, Provider: ${providerId})

What it means

runArtistTask resolves the model and provider ids for the artistry LLM call and throws if either is missing before instantiating the chat provider. The error embeds the current values (possibly undefined) to make the configuration gap diagnosable. It guards against invoking a provider client without a complete model/provider configuration.

Solutions

  1. Configure the artistry model and provider in settings (select both a model id and provider id) before running artist tasks.
  2. Check providersStore for the referenced provider and re-add it if it was deleted.
  3. Add a pre-run guard in the UI that disables the run button until modelId && providerId are set.
  4. Fix stale settings state referencing a removed provider id.

Example fix

// before
await runArtistTask(input) // throws when no model/provider configured
// after
if (!getArtistryModelId() || !getArtistryProviderId())
  await openSettings('providers')
await runArtistTask(input)
Defensive patterns

Strategy: validation

Validate before calling

const modelId = getArtistryModelId()
const providerId = getArtistryProviderId()
if (!modelId || !providerId) {
  openSettings('providers')
  return
}

Try / catch

try {
  await runArtistTask(task)
} catch (e) {
  if (e.message.startsWith('Missing LLM configuration')) ui.showSetupWizard()
  else throw e
}

Prevention

When it happens

Trigger: runArtistTask with no configured artistry model: modelId or providerId resolves to ''/undefined — e.g. no default model selected for the artistry module, or the chosen provider was deleted from the providers store.

Common situations: Fresh install where the user never configured an image/LLM provider; a provider entry removed or renamed while the artistry module still points at it; settings sync bringing incomplete provider config into a new window.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of moeru-ai/airi@438a067dde (2026-09-17). Data as JSON: /api/errors/cbb6e3a0ee451ea9. Report an issue: GitHub.

Appendix: source

Thrown at packages/stage-ui/src/stores/modules/artistry-autonomous.ts:157

        {
          role: 'user',
          content: analysisPrompt,
        },
      ]

      const modelId = consciousnessStore.activeModel
      const providerId = consciousnessStore.activeProvider

      artistLog('Sending rolled-up prompt to Director LLM...', {
        model: modelId,
        provider: providerId,
        historyCount: recentHistory.length,
        textSubstring: inputText.substring(0, 50),
        target,
      })

      if (!modelId || !providerId) {
        throw new Error(`Missing LLM configuration (Model: ${modelId}, Provider: ${providerId})`)
      }

      const chatProvider = await providersStore.getChatProviderInstance(providerId)

      // NOTICE: Artificial 10s delay for USER target to avoid race conditions/429s.
      // Skipped for ASSISTANT target as the main response is already finalized.
      if (target === 'user') {
        artistLog('User target detected. Applying 10s safety delay...')
        await new Promise(resolve => setTimeout(resolve, 10000))
      }

      // 2. Call LLM (Non-streaming for structured data)
      // Bypasses the chat orchestrator's llm_request_* funnel — emit a
      // dedicated event so Director LLM cost is separable from chat.
      useAnalytics().trackAutonomousGenerateText({
        model: modelId,
        reason: target,
      })

View on GitHub (pinned to 438a067dde)