[GH-ISSUE #250] Attempt to JSON.parse(opts['tac_keymap']), but opts['tac_keymap'] may sometimes be undefined #180

Closed
opened 2026-10-30 21:20:34 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @ivucica on GitHub (Nov 5, 2023).
Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/250

Looks like opts['tac_keymap'] is undefined on my machine, despite being set in config.json. This is true for a variety of other config options that seem like they should be in opts, especially all tac_ settings.

This means an attempt to JSON.parse(opts['tac_keymap']) fails here: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/blob/main/javascript/tagAutocomplete.js#L253

This happens even after disabling every other extension except for a1111-sd-webui-tagcomplete.

This is on webui tag v1.6.0, 5ef669de080814067961f28357256e8fe27544f4, from Aug 31 -- the latest ~stable release. I've tried several stable tags of a1111-sd-webui-tagcomplete, but given git blame says those lines are from 8mo ago, I suspect something changed in a1111 rather than in the extension.

Could this be the cause of #231? Is opts the right place this was meant to be read from? Should I just roll forward beyond a1111 1.6.0?

Originally created by @ivucica on GitHub (Nov 5, 2023). Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/250 Looks like `opts['tac_keymap']` is `undefined` on my machine, despite being set in `config.json`. This is true for a variety of other config options that seem like they should be in `opts`, especially all `tac_` settings. This means an attempt to `JSON.parse(opts['tac_keymap'])` fails here: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/blob/main/javascript/tagAutocomplete.js#L253 This happens even after disabling every other extension except for `a1111-sd-webui-tagcomplete`. This is on webui tag `v1.6.0`, `5ef669de080814067961f28357256e8fe27544f4`, from Aug 31 -- the latest ~stable release. I've tried several stable tags of `a1111-sd-webui-tagcomplete`, but given git blame says those lines are from 8mo ago, I suspect something changed in a1111 rather than in the extension. Could this be the cause of #231? Is `opts` the right place this was meant to be read from? Should I just roll forward beyond a1111 1.6.0?
Author
Owner

@ivucica commented on GitHub (Nov 5, 2023):

(This is not the cause of #231 in my case -- for me, it was that a .safetensors file was, inexplicably, a directory rather than a file. I'll open a new bug for that issue.)

<!-- gh-comment-id:1793594600 --> @ivucica commented on GitHub (Nov 5, 2023): (This is not the cause of #231 in my case -- for me, it was that a `.safetensors` file was, inexplicably, a directory rather than a file. I'll open a new bug for that issue.)
Author
Owner

@ivucica commented on GitHub (Nov 5, 2023):

Failed extension startup in Python code may cause breakage in Javascript as well. This might be closeable in favor of #251 since the extension should not fail to start up, or it should perhaps be otherwise addressed (e.g. detecting that opts is incomplete and performing some other action instead of passing an undefined object into JSON.parse).

<!-- gh-comment-id:1793596080 --> @ivucica commented on GitHub (Nov 5, 2023): Failed extension startup in Python code may cause breakage in Javascript as well. This might be closeable in favor of #251 since the extension should not fail to start up, or it should perhaps be otherwise addressed (e.g. detecting that `opts` is incomplete and performing some other action instead of passing an undefined object into `JSON.parse`).
Author
Owner

@DominikDoom commented on GitHub (Nov 5, 2023):

Opts will never be incomplete during normal operation, since all options have a default provided in the python code that will fill them in even if not set by the user. As you already mentioned yourself, this is just because the python error you linked prevents it from even getting far enough to declare the options.

Breaking is the correct thing here, there's literally no way for the extension to function if the options are missing since they define everything. The javascript side does not declare its own option defaults since they would just be redundant under normal circumstances. But of course I'll try to fix the root issue.

<!-- gh-comment-id:1793712387 --> @DominikDoom commented on GitHub (Nov 5, 2023): Opts will never be incomplete during normal operation, since all options have a default provided in the python code that will fill them in even if not set by the user. As you already mentioned yourself, this is just because the python error you linked prevents it from even getting far enough to declare the options. Breaking is the correct thing here, there's literally no way for the extension to function if the options are missing since they define everything. The javascript side does not declare its own option defaults since they would just be redundant under normal circumstances. But of course I'll try to fix the root issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DominikDoom/a1111-sd-webui-tagcomplete#180
No description provided.