Skip to content

Plex history import fails from Profile Settings but works from Admin Settings #407

Closed

Description

@fluxis

Summary

every time tried to import plex watch history, failed tho successful authentication

Reply digest

Plex watch-history import fails (despite successful authentication) when started from Profile Settings, but works from Admin Settings. The two are separate flows: the profile OAuth path POSTs a browser-discovered plex.direct/LAN base URL that the backend (in Docker) frequently can't reach, so FetchLibrarySections errors and the whole run fails; the admin path uses an operator-vetted saved base URL + stored token. Confirmed by the reporter (drahmed86).

Code references

Verified OPEN as of 2026-07-14 against origin/main; #388 (open) adds admin OAuth but does not fix the profile path. Route profile imports through a reachable base URL (remote<->local fallback) or surface the fetch error instead of failing the run.

  • web/src/pages/settings/HistoryImportSettings.tsx:259-266 — profile OAuth start POSTs a client-discovered plex_base_url (remoteURL||localURL from plex.tv in the browser) + per-server token to /history-imports/runs.
  • internal/historyimport/service.go:373-381 — resolvePlexAuth trusts input.PlexBaseURL verbatim; plex_provider.go:28-31 FetchLibrarySections(baseURL, token) then service.go:462-466 failRun fails the whole run on any error.
  • internal/api/router.go:2657 (admin path) — POST /admin/history-imports/sources/{id}/bulk-run -> BulkCreateAdminRuns runs against an operator-vetted saved source base_url + stored token, which is why admin works.

Attachments

None.

Source

Imported from Discord:

Activity

  1. added theissue type on Jul 14, 2026
  2. added a commit that references this issue on Sep 16, 2026
    25d8827
  3. added
    bug
    triaged
    and removed
    triaged
    bug
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions