invoke-ai/InvokeAI · error
Default workflows cannot be created via this method
Error message
Default workflows cannot be created via this method
What it means
create() refuses to insert workflows whose meta.category is WorkflowCategory.Default. Default workflows are managed exclusively by _sync_default_workflows (shipped with the app), so the public create path rejects them to avoid duplicate or user-modified default records.
Source
Thrown at invokeai/app/services/workflow_records/workflow_records_sqlite.py:58
SELECT workflow_id, workflow, name, created_at, updated_at, opened_at, user_id, is_public
FROM workflow_library
WHERE workflow_id = ?;
""",
(workflow_id,),
)
row = cursor.fetchone()
if row is None:
raise WorkflowNotFoundError(f"Workflow with id {workflow_id} not found")
return WorkflowRecordDTO.from_dict(dict(row))
def create(
self,
workflow: WorkflowWithoutID,
user_id: str = WORKFLOW_LIBRARY_DEFAULT_USER_ID,
is_public: bool = False,
) -> WorkflowRecordDTO:
if workflow.meta.category is WorkflowCategory.Default:
raise ValueError("Default workflows cannot be created via this method")
with self._db.transaction() as cursor:
workflow_with_id = Workflow(**workflow.model_dump(), id=uuid_string())
cursor.execute(
"""--sql
INSERT OR IGNORE INTO workflow_library (
workflow_id,
workflow,
user_id,
is_public
)
VALUES (?, ?, ?, ?);
""",
(workflow_with_id.id, workflow_with_id.model_dump_json(), user_id, is_public),
)
return self.get(workflow_with_id.id)
def update(self, workflow: Workflow, user_id: Optional[str] = None) -> WorkflowRecordDTO:View on GitHub (pinned to 0b6a024f2f)
Solutions
- Change meta.category to WorkflowCategory.Custom before calling create
- Or use the app's built-in default workflows directly instead of re-creating them
- Clone-with-category helper: dump the model, set category='custom', then create
Example fix
// before service.create(default_workflow) # category: Default // after data = default_workflow.model_dump() data["meta"]["category"] = "custom" service.create(WorkflowWithoutID(**data))
Defensive patterns
Strategy: validation
Validate before calling
from invokeai.app.services.workflow_records.workflow_records_common import WorkflowCategory assert workflow.meta.category is not WorkflowCategory.Default, "clone with Custom category before create"
Try / catch
try:
record = service.create(workflow)
except ValueError as e:
if "Default workflows cannot be created" in str(e):
data = workflow.model_dump(); data["meta"]["category"] = "custom"
record = service.create(WorkflowWithoutID(**data))
else:
raise Prevention
- Always set category to Custom for user-created/imported workflows
- Never round-trip default workflow JSON back through create()
- Write a clone helper that strips Default markers
When it happens
Trigger: Calling create(workflow) where workflow.meta.category == WorkflowCategory.Default, e.g. round-tripping a default workflow's JSON back into create.
Common situations: Re-importing an exported default workflow; copying a built-in workflow as a template without changing its category; scripts that clone workflows wholesale.
Related errors
- Default workflows cannot be updated
- Default workflows cannot be deleted
- A saved workflow must be selected before executing call_save
- The selected saved workflow '${self.workflow_id}' could not
- Workflow return key must not be empty.
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/4220c15c1b70560e.
Report an issue: GitHub.