Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(models): an Ollama model downloads without one already picked

purpled61879f569f7
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index 8d7e7e0a..908e7979 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -22,7 +22,6 @@ import { ModelGridSkeleton } from '../layout/ViewSkeletons'
import { useProviderStore } from '../../stores/providerStore'
import { useSettingsStore } from '../../stores/settingsStore'
import { useModelStore } from '../../stores/modelStore'
-import { getProviderIdFromModel } from '../../api/providers'
import { activateDownloadedBundledModel } from '../../lib/bundled-download-activation'
import { diagnoseBuiltinEngine } from '../../api/builtin-ensure'
import type { InstalledModelLike } from '../../lib/lmstudio-match'
@@ -30,7 +29,7 @@ import { findInstalledForDiscoverModel } from '../../lib/discover-installed'
import { isBuiltinEngineEntry } from '../../lib/lmstudio-match'
import { ensureLuEngineIsChatProvider, announceLuEngineSwitch } from '../../api/lu-engine-switch'
import { LuEngineSwitchBar } from '../chat/LuEngineSwitchBar'
-import { resolveTextDownloadTarget } from '../../lib/text-download-target'
+import { ollamaOnlyDownloadBlock, resolveTextDownloadTarget } from '../../lib/text-download-target'
import { hfUrlToOllamaRef, hfUrlToLmStudioSubdir, parseHfUrl, extractGgufQuant, isShardedOrIncompatibleGguf } from '../../lib/hf-to-provider'
import { HINWEIS_TEXT } from '../../lib/hinweis'
import { GlowButton } from '../ui/GlowButton'
@@ -607,12 +606,11 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
// chat side. Fix: derive the target backend from the *active chat
// model*. If no active model yet (first run, brand new install), fall
// back to the previous enabled-wins logic so the download still works.
- const activeProviderId = activeChatModel ? getProviderIdFromModel(activeChatModel) : null
// Built-in engine lives in the managed `openai` slot. A second chat model
// downloaded here goes flat into the app-owned models dir and boots
// llama-server, mirroring onboarding — never nested like LM Studio.
//
- // GH #118: the three flags below used to be read off `activeProviderId`
+ // GH #118: the three flags below used to be read off the active provider
// alone, so a fresh install (no chat model picked yet) matched none of
// them and the file went down the LM Studio branch into a nested folder
// the built-in engine never scans. resolveTextDownloadTarget keeps the
@@ -626,18 +624,11 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
const isActiveLmStudio = downloadTarget === 'lmstudio'
const isActiveOllama = downloadTarget === 'ollama'
- // Ollama-native models: only meaningful with Ollama present. If the user
- // is chatting on LM Studio and clicks one of these (e.g. Qwen3.6 35B
- // listed only by Ollama tag), warn instead of silently pulling into a
- // backend the user can't see from chat.
+ // Ollama-native models land in Ollama whatever the picker holds.
if (model.ollamaModel) {
- const ollamaOn = !!providers.ollama?.enabled
- if (!ollamaOn) {
- setInstallError(`${model.name} only runs on Ollama. Enable the Ollama provider (Settings → Providers) before downloading.`)
- return
- }
- if (activeProviderId && !isActiveOllama) {
- setInstallError(`${model.name} can only run on Ollama. Switch the chat picker to an Ollama model first, then download.`)
+ const blocked = ollamaOnlyDownloadBlock(model.name, !!providers.ollama?.enabled)
+ if (blocked) {
+ setInstallError(blocked)
return
}
try {
diff --git a/src/lib/__tests__/an-ollama-model-downloads-without-one-installed.test.ts b/src/lib/__tests__/an-ollama-model-downloads-without-one-installed.test.ts
new file mode 100644
index 00000000..b3ec6955
--- /dev/null
+++ b/src/lib/__tests__/an-ollama-model-downloads-without-one-installed.test.ts
@@ -0,0 +1,26 @@
+/**
+ * applejames, Discord 2026-09-15 and 2026-09-20: "It won't let me download
+ * Ollama models unless I have Ollama models installed". The pull demanded an
+ * Ollama model active in the chat picker, and the picker had none to pick.
+ *
+ * Run: npx vitest run src/lib/__tests__/an-ollama-model-downloads-without-one-installed.test.ts
+ */
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { ollamaOnlyDownloadBlock } from '../text-download-target'
+
+describe('an Ollama-only model', () => {
+ it('downloads whenever Ollama is on, whatever the chat picker holds', () => {
+ expect(ollamaOnlyDownloadBlock('Qwen 3.8 27B (Ollama)', true)).toBeNull()
+ })
+
+ it('says what to switch on when Ollama is off', () => {
+ expect(ollamaOnlyDownloadBlock('Qwen 3.8 27B (Ollama)', false)).toMatch(/Enable the Ollama provider/)
+ })
+
+ it('is the only gate the Discover download asks', () => {
+ const src = readFileSync('src/components/models/DiscoverModels.tsx', 'utf8')
+ expect(src).toContain('ollamaOnlyDownloadBlock(model.name')
+ expect(src).not.toMatch(/Switch the chat picker to an Ollama model/)
+ })
+})
diff --git a/src/lib/text-download-target.ts b/src/lib/text-download-target.ts
index 8e927945..55cdb82a 100644
--- a/src/lib/text-download-target.ts
+++ b/src/lib/text-download-target.ts
@@ -80,3 +80,21 @@ export function resolveTextDownloadTarget(input: TextDownloadTargetInput): TextD
// directory no installed program reads.
return 'builtin'
}
+
+/**
+ * Why an Ollama-only model (one listed by its Ollama tag) cannot be pulled
+ * right now, or null when the pull may go ahead.
+ *
+ * The only real blocker is Ollama being switched off. The pull used to also
+ * demand an Ollama model already active in the chat picker, and a user with
+ * no Ollama model yet could never get one: the picker had nothing of Ollama's
+ * to pick, the download wanted one picked (applejames, Discord 2026-09-15 and
+ * 2026-09-20, "It won't let me download Ollama models unless I have Ollama
+ * models installed"). The model can only ever land in Ollama, so there is no
+ * wrong backend to protect against, and the picker lists it once it is there.
+ */
+export function ollamaOnlyDownloadBlock(modelName: string, ollamaEnabled: boolean): string | null {
+ return ollamaEnabled
+ ? null
+ : `${modelName} only runs on Ollama. Enable the Ollama provider (Settings → Providers) before downloading.`
+}