Skip to content

llm_comfyui: orphan llm.prompt.template records cause KeyError on uninstall #238

Description

@rootdmsnext

Bug

The model llm.prompt.template was removed during the consolidation into llm.prompt (via llm_assistant), but llm_comfyui/data/llm_prompt_data.xml still contains two <record> blocks referencing it:

  • llm_prompt_template_comfyui_workflow (line 29)
  • llm_prompt_template_comfyui_character_gen_v1 (line 205)

Impact

Attempting to uninstall the llm module (or any llm_* module) via the Odoo Apps UI fails with:

KeyError: 'llm.prompt.template'

Traceback path: ir_module.py > button_immediate_uninstall > registry.new > load_modules > module_uninstall > _module_data_uninstall > env[model_name] > KeyError

Root cause

The two orphan records contain ComfyUI workflow JSON templates (~3280 lines of JSON node definitions). These records used fields (prompt_id, role, sequence, content) that belonged to the now-removed llm.prompt.template model.

Discussion: workflow template data migration

The removed records contained valuable ComfyUI workflow definitions. If this data should be preserved, a migration path is needed. However, llm.prompt does not have the equivalent fields that llm.prompt.template had.

Options:

  1. Accept the removal (data was already non-functional)
  2. Recreate a compatible model or add fields to llm.prompt
  3. Store the workflow JSON in an existing text field on llm.prompt

We would appreciate guidance from maintainers on the preferred approach.

Environment

  • Odoo 16.0 CE
  • odoo-llm branch 16.0 (latest)
  • Tested on Windows 10 Pro, PostgreSQL 12.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions