[TPDBMarkers] KeyError: 'groups'
Getting this error when tpdbmarkers runs. Currently on stash v0.28.1
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] Traceback (most recent call last):"
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] File \"/root/.stash/plugins/community/TPDBMarkers/tpdbMarkers.py\", line 206, in <module>"
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] processScene(scene)"
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] File \"/root/.stash/plugins/community/TPDBMarkers/tpdbMarkers.py\", line 64, in processScene"
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] for g in data[\"groups\"]:"
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] ~~~~^^^^^^^^^^"
time="2025-09-02 14:53:10" level=error msg="[Plugin / The Porn DB Markers] KeyError: 'groups'"
time="2025-09-02 14:53:10" level=error msg="Plugin returned error: exit status 1"
I believe all of my packages should be up to date as well
Package Version
------------------ ---------
requests 2.32.3
stashapp-tools 0.2.58
Confirming this issue is still appearing after the latest tpdbmarkers update (0.4.1-377ba6d 9/3/2025 2:23:49 AM)
time="2025-09-02 22:26:31" level=info msg="Updating package timestampTrade"
time="2025-09-02 22:26:36" level=info msg="Finished updating packages"
time="2025-09-02 22:26:36" level=info msg="Updating package TPDBMarkers"
time="2025-09-02 22:26:36" level=info msg="Finished updating packages"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] Traceback (most recent call last):"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] File \"/root/.stash/plugins/community/TPDBMarkers/tpdbMarkers.py\", line 208, in <module>"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] processScene(scene)"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] File \"/root/.stash/plugins/community/TPDBMarkers/tpdbMarkers.py\", line 64, in processScene"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] for g in data[\"groups\"]:"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] ~~~~^^^^^^^^^^"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] KeyError: 'groups'"
time="2025-09-02 22:28:36" level=error msg="Plugin returned error: exit status 1"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] Traceback (most recent call last):"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] File \"/root/.stash/plugins/community/TPDBMarkers/tpdbMarkers.py\", line 208, in <module>"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] processScene(scene)"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] File \"/root/.stash/plugins/community/TPDBMarkers/tpdbMarkers.py\", line 64, in processScene"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] for g in data[\"groups\"]:"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] ~~~~^^^^^^^^^^"
time="2025-09-02 22:28:36" level=error msg="[Plugin / The Porn DB Markers] KeyError: 'groups'"
time="2025-09-02 22:28:36" level=error msg="Plugin returned error: exit status 1"
I'm seeing the same thing. Same python packages too. Running this in Docker. The Porn DB Markers (0.4.1-377ba6d).
time="2025-09-02 21:41:06" level=error msg="[Plugin / The Porn DB Markers] Traceback (most recent call last):"
time="2025-09-02 21:41:06" level=error msg="[Plugin / The Porn DB Markers] File "/config/plugins/community/TPDBMarkers/tpdbMarkers.py", line 208, in
Just to test it out I add some if logic on line 64 (right after groups=[] )
Replaced:
for g in data["groups"]:
group=processGroup(g)
if group:
groups.append({"group_id": group["id"],"scene_index":None})
log.debug(groups)
if len(groups) > 0:
stash.update_scene({'id':scene["id"],"groups":groups})
With (line the if up with groups):
if "groups" in data and data["groups"]:
for g in data["groups"]:
group=processGroup(g)
if group:
groups.append({"group_id": group["id"],"scene_index":None})
log.debug(groups)
if len(groups) > 0:
stash.update_scene({'id':scene["id"],"groups":groups})
else:
Looks like the change to groups from movies did it, I reverted the changes in https://github.com/stashapp/CommunityScripts/commit/a313a93759a690ac141a1a8ec19d7781546f44d9 and it started working for me
Looks like the change to groups from movies did it, I reverted the changes in a313a93 and it started working for me
Actually, looking at the Python, the problem is further up in the file, the conversion missed a bunch of movies... namely in processScene...
Is it possible that the parameters that are supposed to be passed in from the UI are not making its way over to the python script? I noticed that in my selection I have "Create Group from scene" as FALSE for the BOOLEAN but these logs indicate that the script still tried to run it.
UI selections:
YML:
exec:
- python
- "{pluginDir}/tpdbMarkers.py"
interface: raw
hooks:
- name: Add Marker to Scene
description: Makes Markers checking against The Porn DB aka theporndb.net
triggeredBy:
- Scene.Update.Post
settings:
disableSceneMarkerHook:
displayName: Disable the Scene Markers hook
type: BOOLEAN
createMovieFromScene:
displayName: Create Group from scene
description: If there is a Group linked to the scene in the timestamp.trade database automatically create a group in stash with that info
type: BOOLEAN
runOnScenesWithMarkers:
displayName: Run on scenes that already have markers.
type: BOOLEAN
addTPDBMarkerTag:
displayName: Add the [TPDBMarker] tag to created markers.
type: BOOLEAN
addTPDBMarkerTitle:
displayName: Add "[TPDBMarker]" to the start of generated marker titles.
type: BOOLEAN
overwriteMarkers:
displayName: Overwrite Markers
type: BOOLEAN
mergeMarkers:
displayName: Merge Markers
type: BOOLEAN
tasks:
- name: "Sync"
description: Get markers for all scenes with a stashid from theporndb.net and no markers
defaultArgs:
mode: processScene
.py lines 61-72
if settings["createMovieFromScene"] and len(scene.get("groups", [])) == 0:
groups=[]
for g in data["groups"]:
group=processGroup(g)
if group:
groups.append({"group_id": group["id"],"scene_index":None})
log.debug(groups)
if len(groups) > 0:
stash.update_scene({'id':scene["id"],"groups":groups})
else:
log.error('bad response from tpdb: %s' % (res.status_code,))
.py lines 174-191
FRAGMENT_SERVER = json_input["server_connection"]
stash = StashInterface(FRAGMENT_SERVER)
config = stash.get_configuration()["plugins"]
settings = {
"disableSceneMarkerHook": False,
"createMovieFromScene":True,
"addTPDBMarkerTag": False,
"addTPDBMarkerTitle": False,
"runOnScenesWithMarkers": False,
"overwriteMarkers": False,
"mergeMarkers": False,
}
if "tPdBmarkers" in config:
settings.update(config["tPdBmarkers"])
log.debug("settings: %s " % (settings,))```
@heeroyuy852 you can check what the value is actually set in your config.yml for Stash.
@heeroyuy852 you can check what the value is actually set in your
config.ymlfor Stash.
the config.yml was correctly reflecting but I was misunderstanding the section of the code that utilizes the createMovieFromScene. sorry about that.
@DogmaDragon follow up:
I switched the code in lines 179 - 188 to match what I had in the GUI and config.yml. The plugin is running with no errors:
config = stash.get_configuration()["plugins"]
settings = {
"disableSceneMarkerHook": False,
"createMovieFromScene":False,
"addTPDBMarkerTag": False,
"addTPDBMarkerTitle": False,
"runOnScenesWithMarkers": True,
"overwriteMarkers": True,
"mergeMarkers": True,
}
I'm now pretty convinced that the issue is with these parameters. Though I'm not sure yet what the connection is between here and the groups array. Though I suspect that the following IF statement on line 62: if settings["createMovieFromScene"] and len(scene.get("groups", [])) == 0: is part of the problem.
Could the issue be with the length? The script is finding a length but the for loop is failing because it's trying to iterate over something that it can't?
Saw on discourse if anyone else can reproduce; well unfortunately I can:
Windows 11
stash version: v0.28.1-101-gedcc4e89 - Official Build - 2025-09-16 04:31:36
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] Traceback (most recent call last):
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] File "C:\Applications\Stash\plugins\community\TPDBMarkers/tpdbMarkers.py", line 208, in <module>
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] processScene(scene)
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] ~~~~~~~~~~~~^^^^^^^
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] File "C:\Applications\Stash\plugins\community\TPDBMarkers/tpdbMarkers.py", line 64, in processScene
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] for g in data["groups"]:
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] ~~~~^^^^^^^^^^
ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] KeyError: 'groups'
ERRO[2025-09-17 04:39:11] Plugin returned error: exit status 1
Saw on discourse if anyone else can reproduce; well unfortunately I can:
Windows 11
stash version: v0.28.1-101-gedcc4e89 - Official Build - 2025-09-16 04:31:36ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] Traceback (most recent call last): ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] File "C:\Applications\Stash\plugins\community\TPDBMarkers/tpdbMarkers.py", line 208, in <module> ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] processScene(scene) ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] ~~~~~~~~~~~~^^^^^^^ ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] File "C:\Applications\Stash\plugins\community\TPDBMarkers/tpdbMarkers.py", line 64, in processScene ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] for g in data["groups"]: ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] ~~~~^^^^^^^^^^ ERRO[2025-09-17 04:39:11] [Plugin / The Porn DB Markers] KeyError: 'groups' ERRO[2025-09-17 04:39:11] Plugin returned error: exit status 1
hello @planetrocky,
I am reproducing after the update as well. I was able to get around it by applying the edits to the .py file I mentioned in my previous comment. I hope this helps!
@Lurking987 it may fix the above groups problem, but then it fails on GraphQL #599
@planetrocky interesting. I don't receive any issues without timestamp.trade, my markers come in from TPDB just fine after I make my adjustment to address the groups problem.
I believe the error is coming from the data flowing from api itself., i.e. when we run a query against https://api.theporndb.net/scenes/38b2b021-38ba-4daf-8c43-8a71fe3a9ca0 result contains the key movies not the groups { "data": { "id": "38b2b021-38ba-4daf-8c43-8a71fe3a9ca0", "_id": 8114640, "title": ... ........ "scenes": [ ], "movies": [ { "id": "c5b612db-dd4a-41f5-9d02-f73a543e60b5", "_id": 8114638, "title": ".... quick solution suggestion for the plug-in might be is reverting line 64 to data["movies"] for the time being ...