Thx for testing. I see your url is:
https://gunretort.xyz/api.php?action=parse&text={{#categorytree:TOC|hideroot|mode=pages|namespaces=Main}}
It brings up a page of raw json. I notice that it only contains the word "Welcome". It doesn't show any of my subcategories or pages.
I tried your syntax on a wikipage
{{#categorytree:TOC|hideroot|mode=pages|namespaces=Main}}
Again, the result is just the word "Welcome", which is the only page in the top-level TOC category. It does not have an assigned namespace: https://gunretort.xyz/index.php/Welcome
Other pages are in sub-categories of TOC, with no assigned namespace. They don't appear in the tree. Shouldn't they?
This syntax shows all sub-categories, all pages:
{{#categorytree:TOC|hideroot|mode=pages}}
Clue: Extension doc says "namespaces" parameter: >"This overrides the mode
option." It's unclear what "override" means. But it seems it actually disables subcategories.
I performed another test: i created a page in the TOC category, and the "Published" namespace. I also moved a different page to Published namespace, in a subcategory. We get only the page in the top-level TOC category, Published namespace. More evidence that 'namespaces' parameter ignores subcategories.
{{#categorytree:TOC|namespaces=Published}}