{"record":{"id":"2d6dfe56613a52c0","repo":"AUTOMATIC1111/stable-diffusion-webui","slug":"bad-options-item-type-t-for-key-key","errorCode":null,"errorMessage":"bad options item type: {t} for key {key}","messagePattern":"bad options item type: (.+?) for key (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"modules/ui_settings.py","lineNumber":40,"sourceCode":"def create_setting_component(key, is_quicksettings=False):\r\n    def fun():\r\n        return opts.data[key] if key in opts.data else opts.data_labels[key].default\r\n\r\n    info = opts.data_labels[key]\r\n    t = type(info.default)\r\n\r\n    args = info.component_args() if callable(info.component_args) else info.component_args\r\n\r\n    if info.component is not None:\r\n        comp = info.component\r\n    elif t == str:\r\n        comp = gr.Textbox\r\n    elif t == int:\r\n        comp = gr.Number\r\n    elif t == bool:\r\n        comp = gr.Checkbox\r\n    else:\r\n        raise Exception(f'bad options item type: {t} for key {key}')\r\n\r\n    elem_id = f\"setting_{key}\"\r\n\r\n    if info.refresh is not None:\r\n        if is_quicksettings:\r\n            res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {}))\r\n            ui_common.create_refresh_button(res, info.refresh, info.component_args, f\"refresh_{key}\")\r\n        else:\r\n            with FormRow():\r\n                res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {}))\r\n                ui_common.create_refresh_button(res, info.refresh, info.component_args, f\"refresh_{key}\")\r\n    else:\r\n        res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {}))\r\n\r\n    return res\r\n\r\n\r\nclass UiSettings:\r","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/modules/ui_settings.py#L22-L58","documentation":"ui_settings.py builds a Gradio component for every entry in the shared opts. It maps the option's declared type to a default component (str->Textbox, int->Number, bool->Checkbox); any other type without an explicit info.component raises this exception while the settings page is being constructed — i.e., at UI build time, before the page renders.","triggerScenarios":"An extension (or hand-edited code) adding an OptionInfo whose infotype is e.g. list, dict, tuple, or a custom class while leaving component=None. Standard str/int/bool/float-with-component options are fine; a bare list-typed option is the classic offender.","commonSituations":"Extension authors adding settings without reading the option-system docs; version upgrades of an extension switching an option's type from str to a list; merging config files that leave stale option types.","solutions":["For extension authors: pass an explicit Gradio component in OptionInfo, e.g. OptionInfo([], 'My list', component=gr.CheckboxGroup, component_args={'choices': [...]})","For users: update or disable the extension that added the offending option (the traceback names the key)","As a last resort remove the offending key from config.json / the extension's on_ui_settings code so the settings page can build"],"exampleFix":"# before\nshared.opts.add_option('my_opt', shared.OptionInfo([], 'My option'))  # list type, no component\n# after\nimport gradio as gr\nshared.opts.add_option('my_opt', shared.OptionInfo([], 'My option', component=gr.CheckboxGroup, component_args={'choices': ['a', 'b']}))","handlingStrategy":"type-guard","validationCode":"from modules import shared\ndef ui_safe_options():\n    return {k: i for k, i in shared.opts.data_labels.items()\n            if i.component is not None or type(shared.opts.data.get(k)) in (str, int, bool)}","typeGuard":"def option_has_ui_component(info) -> bool:\n    return info.component is not None or type(info) is not None and info.type in (str, int, bool)","tryCatchPattern":null,"preventionTips":["Always pass an explicit Gradio component for non str/int/bool options","Test extension settings pages before shipping (UI build fails at startup)","Read the traceback: it names the exact offending option key"],"tags":["ui","settings","extensions","configuration","gradio"],"backgroundTag":null,"analyzedSha":"82a973c04367123ae98bd9abdf80d9eda9b910e2","analyzedAt":"2026-08-14T16:46:43.225Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}