Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(flux3): point the single-file starters at the renamed Comfy files (#10091)

Alexander Eichhorn6ad8ae7e58ef
diff --git a/invokeai/app/api/routers/model_manager.py b/invokeai/app/api/routers/model_manager.py
index 5ec523488a..be779cde55 100644
--- a/invokeai/app/api/routers/model_manager.py
+++ b/invokeai/app/api/routers/model_manager.py
@@ -1488,7 +1488,7 @@ def get_is_installed(
for model in installed_models:
# Check if source matches exactly
- if model.source == starter_model.source:
+ if model.source == starter_model.source or model.source in starter_model.previous_sources:
return True
# Check if name (or previous names), base and type match
if (
diff --git a/invokeai/backend/model_manager/starter_models/flux3.py b/invokeai/backend/model_manager/starter_models/flux3.py
index 45a023c905..440f9d4ede 100644
--- a/invokeai/backend/model_manager/starter_models/flux3.py
+++ b/invokeai/backend/model_manager/starter_models/flux3.py
@@ -38,11 +38,14 @@ flux3_klein_base = StarterModel(
variant=Flux3VariantType.KleinBase,
)
+# Both single-file builds are pinned to a commit: the repository renamed their files once, which broke the `main` URLs.
flux3_klein_single_file = StarterModel(
name="FLUX.3 Klein (single file)",
base=BaseModelType.Flux3,
- source="https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/main/diffusion_models/"
- "flux3_image_klein_sd_bf16.safetensors",
+ source="https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/feef60b0aaf63a4773ace96636ebbcf43b881312/diffusion_models/flux3-image-klein-bf16.safetensors",
+ previous_sources=[
+ "https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/main/diffusion_models/flux3_image_klein_sd_bf16.safetensors"
+ ],
description="FLUX.3 Image Klein transformer as one bf16 file; the FLUX.2 VAE and Qwen3-VL 4B encoder are "
f"installed as dependencies and shared with other models. ~11GB. {_LICENSE}",
type=ModelType.Main,
@@ -54,8 +57,10 @@ flux3_klein_single_file = StarterModel(
flux3_klein_base_single_file = StarterModel(
name="FLUX.3 Klein Base (single file)",
base=BaseModelType.Flux3,
- source="https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/main/diffusion_models/"
- "flux3_image_klein_bf16.safetensors",
+ source="https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/feef60b0aaf63a4773ace96636ebbcf43b881312/diffusion_models/flux3-image-klein-base-bf16.safetensors",
+ previous_sources=[
+ "https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/main/diffusion_models/flux3_image_klein_bf16.safetensors"
+ ],
description="FLUX.3 Image Klein Base transformer as one bf16 file; the FLUX.2 VAE and Qwen3-VL 4B encoder are "
f"installed as dependencies. ~11GB. {_LICENSE}",
type=ModelType.Main,
diff --git a/invokeai/backend/model_manager/starter_models/types.py b/invokeai/backend/model_manager/starter_models/types.py
index b62d4c3792..cb788ca0e8 100644
--- a/invokeai/backend/model_manager/starter_models/types.py
+++ b/invokeai/backend/model_manager/starter_models/types.py
@@ -35,6 +35,8 @@ class StarterModelWithoutDependencies(BaseModel):
# allows us to track what models a user has installed across name changes within starter models
# if you update a starter model name, please add the old one to this list for that starter model
previous_names: list[str] = []
+ # same for sources: installs made from a superseded URL stay recognized even if the user renamed the model
+ previous_sources: list[str] = []
class StarterModel(StarterModelWithoutDependencies):
diff --git a/invokeai/frontend/api/openapi.json b/invokeai/frontend/api/openapi.json
index 16d4615c5e..549c5ee7a8 100644
--- a/invokeai/frontend/api/openapi.json
+++ b/invokeai/frontend/api/openapi.json
@@ -110596,6 +110596,14 @@
"title": "Previous Names",
"default": []
},
+ "previous_sources": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array",
+ "title": "Previous Sources",
+ "default": []
+ },
"dependencies": {
"anyOf": [
{
@@ -110791,6 +110799,14 @@
"type": "array",
"title": "Previous Names",
"default": []
+ },
+ "previous_sources": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array",
+ "title": "Previous Sources",
+ "default": []
}
},
"type": "object",
diff --git a/invokeai/frontend/api/schema.ts b/invokeai/frontend/api/schema.ts
index 592cdf2fa7..68dcf7f3e1 100644
--- a/invokeai/frontend/api/schema.ts
+++ b/invokeai/frontend/api/schema.ts
@@ -48419,6 +48419,11 @@ export type components = {
* @default []
*/
previous_names?: string[];
+ /**
+ * Previous Sources
+ * @default []
+ */
+ previous_sources?: string[];
/** Dependencies */
dependencies?: components["schemas"]["StarterModelWithoutDependencies"][] | null;
};
@@ -48464,6 +48469,11 @@ export type components = {
* @default []
*/
previous_names?: string[];
+ /**
+ * Previous Sources
+ * @default []
+ */
+ previous_sources?: string[];
};
/**
* Empty Loop State
diff --git a/invokeai/frontend/webv2/src/features/models/core/types.ts b/invokeai/frontend/webv2/src/features/models/core/types.ts
index fc2f27ee07..ed2dd7286c 100644
--- a/invokeai/frontend/webv2/src/features/models/core/types.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/types.ts
@@ -306,6 +306,7 @@ export interface StarterModel {
is_installed: boolean;
dependencies?: Omit<StarterModel, 'dependencies'>[] | null;
previous_names?: string[];
+ previous_sources?: string[];
}
export interface StarterModelBundle {
diff --git a/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.test.ts b/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.test.ts
index e4a6a76882..cec20c2da7 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.test.ts
+++ b/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.test.ts
@@ -19,10 +19,11 @@ const model = (overrides: Partial<ModelConfig>): ModelConfig =>
...overrides,
}) as ModelConfig;
-const starter: Pick<StarterModel, 'base' | 'name' | 'previous_names' | 'source' | 'type'> = {
+const starter: Pick<StarterModel, 'base' | 'name' | 'previous_names' | 'previous_sources' | 'source' | 'type'> = {
base: 'sdxl',
name: 'Juggernaut XL',
previous_names: ['Juggernaut'],
+ previous_sources: ['https://example/jxl-old'],
source: 'https://example/jxl',
type: 'main',
};
@@ -35,6 +36,13 @@ describe('findInstalledStarterModelKey', () => {
);
});
+ it('recognizes a model recorded under a previous source even when it was renamed', () => {
+ const bySource = new Map([['https://example/jxl-old', 'from-old-source']]);
+ expect(findInstalledStarterModelKey(starter, bySource, [model({ key: 'x', name: 'My own name' })])).toBe(
+ 'from-old-source'
+ );
+ });
+
it('falls back to a name or previous name with the same base and type', () => {
const models = [
model({ base: 'sd-1', key: 'wrong-base', name: 'Juggernaut XL' }),
diff --git a/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.ts b/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.ts
index 3a1b214863..59474c3693 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.ts
+++ b/invokeai/frontend/webv2/src/features/models/ui/shared/useInstalledSources.ts
@@ -52,17 +52,19 @@ const starterIdentity = (base: string, type: string, name: string): string => `$
/**
* The installed model a starter entry stands for, matched the way the backend
- * marks starters installed: by install source, else by name (or a previous
+ * marks starters installed: by install source (or a previous source), else by name (or a previous
* name) together with base and type.
*/
export const findInstalledStarterModelKey = (
- starter: Pick<StarterModel, 'base' | 'name' | 'previous_names' | 'source' | 'type'>,
+ starter: Pick<StarterModel, 'base' | 'name' | 'previous_names' | 'previous_sources' | 'source' | 'type'>,
installedSourceKeys: ReadonlyMap<string, string>,
models: readonly ModelConfig[]
): string | null => {
- const bySource = installedSourceKeys.get(starter.source);
- if (bySource !== undefined) {
- return bySource;
+ for (const source of [starter.source, ...(starter.previous_sources ?? [])]) {
+ const bySource = installedSourceKeys.get(source);
+ if (bySource !== undefined) {
+ return bySource;
+ }
}
const names = new Set(
[starter.name, ...(starter.previous_names ?? [])].map((name) => starterIdentity(starter.base, starter.type, name))
diff --git a/tests/app/routers/test_starter_model_is_installed.py b/tests/app/routers/test_starter_model_is_installed.py
index d43507a3c1..35a9ff2b06 100644
--- a/tests/app/routers/test_starter_model_is_installed.py
+++ b/tests/app/routers/test_starter_model_is_installed.py
@@ -43,3 +43,21 @@ def test_an_fp4_encoder_starter_is_satisfied_by_an_installed_encoder_of_its_size
) -> None:
assert get_is_installed(starter, [_installed_encoder(size)])
assert not get_is_installed(starter, [_installed_encoder(other_size)])
+
+
+def test_a_renamed_install_from_a_superseded_source_still_counts_as_installed() -> None:
+ from invokeai.app.api.routers.model_manager import get_is_installed as is_installed
+ from invokeai.backend.model_manager.configs.main import Main_Checkpoint_Flux3_Config
+ from invokeai.backend.model_manager.starter_models.flux3 import flux3_klein_single_file
+
+ old_source = flux3_klein_single_file.previous_sources[0]
+ assert old_source != flux3_klein_single_file.source
+ renamed = Main_Checkpoint_Flux3_Config.model_construct(
+ key="installed",
+ name="my klein",
+ source=old_source,
+ base=flux3_klein_single_file.base,
+ type=flux3_klein_single_file.type,
+ )
+ assert is_installed(flux3_klein_single_file, [renamed])
+ assert not is_installed(flux3_klein_single_file, [renamed.model_copy(update={"source": "D:/other.safetensors"})])
diff --git a/tests/backend/model_manager/load/state_dicts/flux3_klein_keys.py b/tests/backend/model_manager/load/state_dicts/flux3_klein_keys.py
index 696a84adcd..0d17ae7c25 100644
--- a/tests/backend/model_manager/load/state_dicts/flux3_klein_keys.py
+++ b/tests/backend/model_manager/load/state_dicts/flux3_klein_keys.py
@@ -1,8 +1,10 @@
-"""FLUX.3 Image Klein (step-distilled), BFL's native bf16 layout -- `model.safetensors` and its byte-identical ComfyUI repackage `flux3_image_klein_sd_bf16.safetensors`.
+"""FLUX.3 Image Klein (step-distilled), BFL's native bf16 layout -- `model.safetensors` and its byte-identical ComfyUI repackage `flux3-image-klein-bf16.safetensors`.
Captured on 2026-10-16 with `scripts/capture_state_dict_fixture.py`,
which reads the header only, from
-`E:/ModelStuffSSD/flux-3-image-klein-comfy/diffusion_models/flux3_image_klein_sd_bf16.safetensors`.
+`black-forest-labs/flux-3-image-klein-comfy/diffusion_models/flux3_image_klein_sd_bf16.safetensors`.
+The repository renamed that file to `flux3-image-klein-bf16.safetensors` on 2026-10-17; it is the same LFS object as
+`black-forest-labs/flux-3-image-klein/model.safetensors`.
Subsetting rule: `content_mode_blocks.image` index 0, `content_mode_blocks.image_cond` index 0, `single_blocks` index 0, `txt_mode_blocks` index 0, plus every key outside a stack. Values are `(shape, dtype)`.