{"record":{"id":"a87567c8f7d905aa","repo":"moeru-ai/airi","slug":"vision-provider-model-not-configured","errorCode":null,"errorMessage":"Vision provider/model not configured","messagePattern":"Vision provider/model not configured","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/stage-ui/src/composables/vision/use-vision-inference.ts","lineNumber":47,"sourceCode":"  const base64 = meta?.includes('base64') ? data : btoa(data)\n  return {\n    mimeType,\n    base64,\n    url: `data:${mimeType};base64,${base64}`,\n  }\n}\n\nexport function useVisionInference() {\n  const llmStore = useLLM()\n  const providersStore = useProviderStore()\n  const visionStore = useVisionStore()\n  const { activeProvider, activeModel, ollamaThinkingEnabled } = storeToRefs(visionStore)\n\n  const lastText = ref('')\n\n  async function runVisionInference(input: VisionInferenceInput) {\n    if (!activeProvider.value || !activeModel.value)\n      throw new Error('Vision provider/model not configured')\n\n    const provider = await providersStore.getProviderInstance<ChatProvider>(activeProvider.value)\n    const workload = getVisionWorkload(input.workloadId)\n    const prompt = input.promptOverride ?? workload.prompt\n    const { url } = parseDataUrl(input.imageDataUrl)\n    const visionProvider = activeProvider.value === 'vision-ollama'\n      ? {\n        ...provider,\n        chat(model: string) {\n          return {\n            ...provider.chat(model),\n            think: ollamaThinkingEnabled.value,\n          }\n        },\n      } satisfies ChatProvider\n      : provider\n\n    const contentParts: CommonContentPart[] = [","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/stage-ui/src/composables/vision/use-vision-inference.ts#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open vision settings and select both a vision-capable provider (e.g. an OpenAI-compatible or Ollama provider) and a model.","Gate the UI that calls runVisionInference behind `activeProvider && activeModel` so the call cannot fire unconfigured.","If the selection was lost after a reset, re-persist the choice in the vision store before invoking inference."],"exampleFix":"// before: calling inference unconditionally\nawait runVisionInference(input)\n// after: guard at the call site\nif (!activeProvider.value || !activeModel.value) {\n  // prompt user to configure vision provider/model\n  return\n}\nawait runVisionInference(input)","handlingStrategy":"validation","validationCode":"import { storeToRefs } from 'pinia'\nconst { activeProvider, activeModel } = storeToRefs(useVisionStore())\nfunction canRunVision(): boolean {\n  return !!activeProvider.value && !!activeModel.value\n}\n// before invoking:\nif (!canRunVision()) {\n  // prompt user to configure vision provider/model; do not call runVisionInference\n}","typeGuard":"function hasVisionConfig(store: ReturnType<typeof useVisionStore>): boolean {\n  const { activeProvider, activeModel } = storeToRefs(store)\n  return activeProvider.value != null && activeModel.value != null && activeModel.value !== ''\n}","tryCatchPattern":"try {\n  await runVisionInference(input)\n}\ncatch (err) {\n  if (err instanceof Error && err.message === 'Vision provider/model not configured') {\n    // route user to vision settings instead of surfacing a generic error\n  }\n  else throw err\n}","preventionTips":["Disable the vision UI action unless both activeProvider and activeModel are set.","After resetSettingsState(), force the user to reconfigure vision before the feature is reachable.","Persist vision selection so it survives reloads."],"tags":["configuration","vision","precondition","state","validation"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}