[GH-ISSUE #186] ValueError: '/1/tags' is not in the subpath of '/2' OR one path is relative and the other is absolute #132

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

Originally created by @TokcDK on GitHub (Jun 10, 2023).
Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/186

Suppose the error happen when --data-dir run parameter of sd is set.

Error itself:
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 224, in
write_tag_base_path()
File "/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 191, in write_tag_base_path
f.write(TAGS_PATH.relative_to(FILE_DIR).as_posix())
File "/usr/lib/python3.10/pathlib.py", line 818, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/tags' is not in the subpath of '/content/repository' OR one path is relative and the other is absolute.

run parameters: -u -m launch --data-dir /content/drive/MyDrive/SD --xformers --xformers-flash-attention

Originally created by @TokcDK on GitHub (Jun 10, 2023). Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/186 Suppose the error happen when --data-dir run parameter of sd is set. Error itself: File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 224, in write_tag_base_path() File "/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 191, in write_tag_base_path f.write(TAGS_PATH.relative_to(FILE_DIR).as_posix()) File "/usr/lib/python3.10/pathlib.py", line 818, in relative_to raise ValueError("{!r} is not in the subpath of {!r}" ValueError: '/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/tags' is not in the subpath of '/content/repository' OR one path is relative and the other is absolute. run parameters: -u -m launch --data-dir /content/drive/MyDrive/SD --xformers --xformers-flash-attention
bsakaguchi 2026-10-30 21:19:50 +00:00
  • closed this issue
  • added the
    duplicate
    label
Author
Owner

@DominikDoom commented on GitHub (Jun 10, 2023):

This is due to a Gradio security feature / issue. The javascript side of the extension (~80% of the functionality) will not be able to access files that are not in the root folder of the webui. And for good reason, as Gradio is a local server that can be shared and thus accessed from outside, if arbitrary client side javascript could access any files on your system, it would be a massive risk.

But due to this, as you said, if the data dir or extensions dir is anywhere outside of the webui root, the script won't work. Sadly nothing I can do about it with the current way this works, it would need manual deactivation of the aforementioned Gradio security features by editing their code.

<!-- gh-comment-id:1585599616 --> @DominikDoom commented on GitHub (Jun 10, 2023): This is due to a Gradio security feature / issue. The javascript side of the extension (~80% of the functionality) will not be able to access files that are not in the root folder of the webui. And for good reason, as Gradio is a local server that can be shared and thus accessed from outside, if arbitrary client side javascript could access any files on your system, it would be a massive risk. But due to this, as you said, if the data dir or extensions dir is anywhere outside of the webui root, the script won't work. Sadly nothing I can do about it with the current way this works, it would need manual deactivation of the aforementioned Gradio security features by editing their code.
Author
Owner

@DominikDoom commented on GitHub (Jun 15, 2023):

@TokcDK Good news, if still needed:
With the most recent update, the extension can now work with data-dir.

You will need to add the --gradio-allowed-path argument to your webui start script to make this work, else the helper will not throw the error anymore, but the server will still return 403 Unauthorized for any extension javascript file or tags file the webui tries to load.

A word of caution if you share the webui on your local network or even as a public server:
The allowed path will be publicly exposed. A simple JavaScript fetch("file=path/to/file") can access any file contents in that directory and its subdirectories, as long as the filename is known. You need to be careful what you allow in there.
I suggest only allowing the install dir of tag autocomplete itself for base functionality, or if you use wildcard extensions and want to use the wildcard completion feature, the whole extensions dir at most.

<!-- gh-comment-id:1593611667 --> @DominikDoom commented on GitHub (Jun 15, 2023): @TokcDK Good news, if still needed: With the most recent update, the extension can now work with data-dir. You will need to add the `--gradio-allowed-path` argument to your webui start script to make this work, else the helper will not throw the error anymore, but the server will still return 403 Unauthorized for any extension javascript file or tags file the webui tries to load. A word of caution if you share the webui on your local network or even as a public server: The allowed path will be <ins>**publicly exposed**</ins>. A simple JavaScript `fetch("file=path/to/file")` can access any file contents in that directory and its subdirectories, as long as the filename is known. You need to be careful what you allow in there. I suggest only allowing the install dir of tag autocomplete itself for base functionality, or if you use wildcard extensions and want to use the wildcard completion feature, the whole extensions dir at most.
Author
Owner

@TokcDK commented on GitHub (Jun 16, 2023):

/content/drive/MyDrive/SD

Ok, understood you. Thanks for the info!

<!-- gh-comment-id:1594097415 --> @TokcDK commented on GitHub (Jun 16, 2023): > /content/drive/MyDrive/SD Ok, understood you. Thanks for the info!
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#132
No description provided.