/player/playback/play: 500 Internal Server Error. "X-Plex-Target-Client-Identifier" not found.

I’m trying to figure out how to get the remote API playback to work after getting most of the other API stuff to work splendidly, but end up getting a 500 Internal Server Error. The X-Plex-Target-Client-Identifier value is retrieved from my user’s lastPrimaryServerID or machineIdentifier as done in python-plexapi (see here for implementation). Could anyone tell me what I could be doing wrong?

I’m sending the following request:

GET /player/playback/play?type=video&commandID=5 HTTP/1.1
Host: <redacted>.plex.direct:32400
User-Agent: insomnia/5.16.2
Cookie: com.plexapp.system=<redacted>
X-Plex-Token: <redacted>
X-Plex-Target-Client-Identifier: <redacted>
X-Plex-Target-Identifier: <redacted>
X-Plex-Device-Name: <redacted>
Accept: */*

And I’m receiving the following

HTTP/1.1 500 Internal Server Error
Set-Cookie: com.plexapp.system=<redacted>
Content-Length: 726
Content-Type: application/xml
Cache-Control: no-cache
Connection: Keep-Alive
Keep-Alive: timeout=20
X-Plex-Protocol: 1.0
Date: Mon, 21 May 2018 00:36:04 GMT

<?xml version='1.0' encoding='utf-8'?>
<Response code="2000" status="FrameworkException: Unable to find player with identifier <redacted>">
	<Traceback>Traceback (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-31d3c0c65/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request
    result = f(**d)
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-31d3c0c65/System.bundle/Contents/Code/playerservice.py", line 50, in process_remote_command
    raise FrameworkException('Unable to find player with identifier %s' % identifier)
FrameworkException: Unable to find player with identifier <redacted>
</Traceback>
</Response>

I have the same problem. Did you find a solution?

When applying the command, my Plex Console is saying:

Aug 02, 2019 23:10:00.736 [] Debug — Request: [192.168.178.50:15459 (Allowed Network (Subnet))] GET /system/players/192.168.178.13/pause (13 live) GZIP Signed-in
Aug 02, 2019 23:10:00.737 [] Debug — [com.plexapp.system] Sending command over HTTP (GET): /system/players/192.168.178.13/pause
Aug 02, 2019 23:10:00.738 [] Debug — HTTP requesting GET http://127.0.0.1:57305/system/players/192.168.178.13/pause
Aug 02, 2019 23:10:00.753 [] Debug — HTTP 404 response from GET http://127.0.0.1:57305/system/players/192.168.178.13/pause
Aug 02, 2019 23:10:00.753 [] Debug — [com.plexapp.system] HTTP reply status 404, with 0 bytes of content.
Aug 02, 2019 23:10:00.754 [] Debug — Completed: [192.168.178.50:15459] 404 GET /system/players/192.168.178.13/pause (13 live) GZIP 17ms 177 bytes (pipelined: 3)

Looks like the IP gets changed and thus a 404 is returned.

I found the solution and documented it here: https://github.com/phillipj/node-plex-control/issues/32