moeru-ai/airi · error · Error

Vision provider/model not configured

Error message

Vision provider/model not configured

What it means

Thrown by runVisionInference() at entry when either activeProvider or activeModel in the vision store is unset. Vision inference needs a concrete provider instance and a model id to build the chat request, so the function aborts before contacting any provider. This is a configuration precondition, not a runtime/network failure.

Source

Thrown at packages/stage-ui/src/composables/vision/use-vision-inference.ts:47

  const base64 = meta?.includes('base64') ? data : btoa(data)
  return {
    mimeType,
    base64,
    url: `data:${mimeType};base64,${base64}`,
  }
}

export function useVisionInference() {
  const llmStore = useLLM()
  const providersStore = useProviderStore()
  const visionStore = useVisionStore()
  const { activeProvider, activeModel, ollamaThinkingEnabled } = storeToRefs(visionStore)

  const lastText = ref('')

  async function runVisionInference(input: VisionInferenceInput) {
    if (!activeProvider.value || !activeModel.value)
      throw new Error('Vision provider/model not configured')

    const provider = await providersStore.getProviderInstance<ChatProvider>(activeProvider.value)
    const workload = getVisionWorkload(input.workloadId)
    const prompt = input.promptOverride ?? workload.prompt
    const { url } = parseDataUrl(input.imageDataUrl)
    const visionProvider = activeProvider.value === 'vision-ollama'
      ? {
        ...provider,
        chat(model: string) {
          return {
            ...provider.chat(model),
            think: ollamaThinkingEnabled.value,
          }
        },
      } satisfies ChatProvider
      : provider

    const contentParts: CommonContentPart[] = [

View on GitHub (pinned to 27111382b4)

Solutions

  1. Open vision settings and select both a vision-capable provider (e.g. an OpenAI-compatible or Ollama provider) and a model.
  2. Gate the UI that calls runVisionInference behind `activeProvider && activeModel` so the call cannot fire unconfigured.
  3. If the selection was lost after a reset, re-persist the choice in the vision store before invoking inference.

Example fix

// before: calling inference unconditionally
await runVisionInference(input)
// after: guard at the call site
if (!activeProvider.value || !activeModel.value) {
  // prompt user to configure vision provider/model
  return
}
await runVisionInference(input)
Defensive patterns

Strategy: validation

Validate before calling

import { storeToRefs } from 'pinia'
const { activeProvider, activeModel } = storeToRefs(useVisionStore())
function canRunVision(): boolean {
  return !!activeProvider.value && !!activeModel.value
}
// before invoking:
if (!canRunVision()) {
  // prompt user to configure vision provider/model; do not call runVisionInference
}

Type guard

function hasVisionConfig(store: ReturnType<typeof useVisionStore>): boolean {
  const { activeProvider, activeModel } = storeToRefs(store)
  return activeProvider.value != null && activeModel.value != null && activeModel.value !== ''
}

Try / catch

try {
  await runVisionInference(input)
}
catch (err) {
  if (err instanceof Error && err.message === 'Vision provider/model not configured') {
    // route user to vision settings instead of surfacing a generic error
  }
  else throw err
}

Prevention

When it happens

Trigger: Calling runVisionInference(input) while useVisionStore's activeProvider.value or activeModel.value is null/undefined. The user opened a vision feature (image Q&A) without first selecting a vision-capable provider and a model in vision settings.

Common situations: Fresh install / reset state where vision settings were never configured. The user cleared settings or the store was reset by resetSettingsState(). A selected provider was removed from the provider list, leaving a dangling null selection.

Related errors


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