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): a CivitAI GGUF lands where ComfyUI reads it

purple361b3ffb7746
diff --git a/src/api/__tests__/a-civitai-gguf-lands-where-comfyui-reads-it.test.ts b/src/api/__tests__/a-civitai-gguf-lands-where-comfyui-reads-it.test.ts
new file mode 100644
index 00000000..59a6cc77
--- /dev/null
+++ b/src/api/__tests__/a-civitai-gguf-lands-where-comfyui-reads-it.test.ts
@@ -0,0 +1,80 @@
+/**
+ * rantokim, Discord 2026-09-23 (Windows 11, RTX 5060 Ti 16 GB): a CivitAI
+ * GGUF, qwenImageEdit2511_q50.gguf, downloaded to "Complete" and the
+ * Installed tab stayed at 0. It went to checkpoints/, which no loader reads
+ * for .gguf, and the ComfyUI-GGUF pack that reads diffusion_models/ was never
+ * installed for it.
+ *
+ * Run: npx vitest run src/api/__tests__/a-civitai-gguf-lands-where-comfyui-reads-it.test.ts
+ */
+import { describe, it, expect, beforeEach, vi } from 'vitest'
+
+const backendCall = vi.fn()
+const fetchExternal = vi.fn()
+vi.mock('../backend', () => ({
+ backendCall: (...args: unknown[]) => backendCall(...args),
+ fetchExternal: (...args: unknown[]) => fetchExternal(...args),
+ isTauri: () => true,
+ isMacOS: () => false,
+ secretGet: vi.fn().mockRejectedValue(new Error('no keychain here')),
+ secretSet: vi.fn(),
+ secretDelete: vi.fn(),
+}))
+
+let nodes: Record<string, unknown> = {}
+vi.mock('../comfyui-nodes', () => ({
+ getAllNodeInfo: async () => nodes,
+ clearNodeCache: () => {},
+}))
+vi.mock('../comfy-restart', () => ({ restartComfyForNewNodes: async () => ({ restarted: true }) }))
+
+import { searchCivitaiModels, startCivitaiDownload } from '../discover'
+
+const hit = (fileName: string, itemName: string) => JSON.stringify({
+ items: [{
+ id: 7, name: itemName, stats: {},
+ modelVersions: [{ downloadUrl: 'https://civitai.com/api/download/models/7', files: [{ name: fileName, sizeKB: 1024 }] }],
+ }],
+})
+
+const calls = (cmd: string) => backendCall.mock.calls.filter((c) => c[0] === cmd)
+
+beforeEach(() => {
+ backendCall.mockReset()
+ backendCall.mockImplementation(async (cmd: string) => {
+ if (cmd === 'comfy_model_target') return { remote: false }
+ if (cmd === 'install_custom_node') return { status: 'installed' }
+ return { status: 'started', id: 'x' }
+ })
+ fetchExternal.mockReset()
+ nodes = {}
+})
+
+describe('a GGUF from the CivitAI search', () => {
+ it('goes to diffusion_models, whatever the model is called', async () => {
+ fetchExternal.mockResolvedValue(hit('qwenImageEdit2511_q50.gguf', 'Qwen Image Edit 2511 GGUF'))
+ const [m] = await searchCivitaiModels('qwen edit')
+ expect(m.subfolder).toBe('diffusion_models')
+ })
+
+ it('brings the ComfyUI-GGUF pack along when this ComfyUI lacks it', async () => {
+ await startCivitaiDownload({ downloadUrl: 'https://civitai.com/api/download/models/7', filename: 'x.gguf', subfolder: 'diffusion_models' })
+ await vi.waitFor(() => expect(calls('install_custom_node')).toHaveLength(1))
+ expect(calls('install_custom_node')[0][1]).toMatchObject({ nodeName: 'ComfyUI-GGUF' })
+ })
+
+ // Negative controls: an install restarts ComfyUI, so it happens only when needed.
+ it('installs nothing when the pack is already there', async () => {
+ nodes = { UnetLoaderGGUF: {} }
+ await startCivitaiDownload({ downloadUrl: 'https://civitai.com/api/download/models/7', filename: 'x.gguf', subfolder: 'diffusion_models' })
+ expect(calls('install_custom_node')).toHaveLength(0)
+ })
+
+ it('leaves a safetensors checkpoint where it always went', async () => {
+ fetchExternal.mockResolvedValue(hit('juggernautXL.safetensors', 'Juggernaut XL'))
+ const [m] = await searchCivitaiModels('juggernaut')
+ expect(m.subfolder).toBe('checkpoints')
+ await startCivitaiDownload(m)
+ expect(calls('install_custom_node')).toHaveLength(0)
+ })
+})
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 49992145..431a3d1b 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1,7 +1,7 @@
import { backendCall, fetchExternal } from "./backend"
import { readComfyFolderLists, filterPartialFiles, refreshComfyModels } from "./comfyui"
import { COMPONENT_REGISTRY, type ComponentSpec, type ComponentRequirements } from './component-registry'
-import { clearNodeCache } from "./comfyui-nodes"
+import { clearNodeCache, getAllNodeInfo } from "./comfyui-nodes"
import { restartComfyForNewNodes } from "./comfy-restart"
import type { ProviderId } from "./providers/types"
import { log } from "../lib/logger"
@@ -1824,6 +1824,33 @@ export function civitaiDescriptionToText(html: string): string {
.trim()
}
+/** A GGUF quant, read by the ComfyUI-GGUF pack and by nothing else. */
+export function isGgufFile(filename: string | undefined): boolean {
+ return /\.gguf$/i.test(filename ?? '')
+}
+
+/**
+ * Download a CivitAI hit, and for a GGUF quant make sure ComfyUI can read it.
+ *
+ * A curated bundle installs the ComfyUI-GGUF pack along with its files; a
+ * CivitAI hit had no such step, so a GGUF from the search downloaded fine and
+ * stayed invisible. The pack is installed only when this ComfyUI lacks its
+ * loader (installing restarts ComfyUI, which a running render would not
+ * survive), in the background so the download is never held up, and never
+ * for a ComfyUI on another machine, whose packs this one cannot touch.
+ */
+export async function startCivitaiDownload(model: { downloadUrl?: string; filename?: string; subfolder?: string }): Promise<void> {
+ if (!model.downloadUrl || !model.filename || !model.subfolder) return
+ await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
+ if (!isGgufFile(model.filename)) return
+ const target = await comfyModelTarget()
+ if (target.remote) return
+ const nodes = await getAllNodeInfo().catch(() => null)
+ if (nodes && 'UnetLoaderGGUF' in nodes) return
+ void installCustomNodes(['gguf'], { keepGoing: true, restart: true })
+ .catch((err) => log.warn('[discover] ComfyUI-GGUF install for a CivitAI GGUF failed', { err }))
+}
+
export async function searchCivitaiModels(
query: string,
type: 'Checkpoint' | 'LORA' | 'VAE' | 'TextualInversion' = 'Checkpoint',
@@ -1886,6 +1913,11 @@ export async function searchCivitaiModels(
const filename = asString(prop(file, 'name'))
|| `${(itemName ?? '').replace(/[^a-zA-Z0-9._-]/g, '_')}.safetensors`
+ // A GGUF quant is a bare diffusion model whatever its name says, and the
+ // only loader that lists .gguf (ComfyUI-GGUF's UnetLoaderGGUF) reads
+ // diffusion_models/unet. In checkpoints/ nothing ever saw it (rantokim,
+ // Discord 2026-09-23: qwenImageEdit2511_q50.gguf "Complete", Installed 0).
+ if (type === 'Checkpoint' && isGgufFile(filename)) subfolder = 'diffusion_models'
const descParts: string[] = []
const rawDesc = civitaiDescriptionToText(asString(prop(item, 'description')) ?? '')
diff --git a/src/components/models/CivitaiSearchPanel.tsx b/src/components/models/CivitaiSearchPanel.tsx
index 1b5660fb..c9cd6317 100644
--- a/src/components/models/CivitaiSearchPanel.tsx
+++ b/src/components/models/CivitaiSearchPanel.tsx
@@ -9,7 +9,7 @@
*/
import { useEffect, useState } from 'react'
import { Search, Loader2, ExternalLink, Download, CheckCircle } from 'lucide-react'
-import { searchCivitaiModels, startModelDownload, type CivitAIModelResult } from '../../api/discover'
+import { searchCivitaiModels, startCivitaiDownload, type CivitAIModelResult } from '../../api/discover'
import { openExternal } from '../../api/backend'
import { useDownloadStore } from '../../stores/downloadStore'
import { useWorkflowStore } from '../../stores/workflowStore'
@@ -81,7 +81,7 @@ export function CivitaiSearchPanel({ modelType, title, placeholder, search = '',
const download = async (model: CivitAIModelResult) => {
if (!model.downloadUrl || !model.filename || !model.subfolder) return
dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder)
- await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
+ await startCivitaiDownload(model)
dlStore.getState().startPolling()
}