Skip to content

website: fix ColorModeProvider crash on API reference pages - #24261

Merged
GirlBossRush merged 4 commits into
mainfrom
fix/24026-colormode-duplicate-theme-common
Jul 21, 2026
Merged

GirlBossRush merged 4 commits into
mainfrom
fix/24026-colormode-duplicate-theme-common

Conversation

@GirlBossRush

Copy link
Copy Markdown
Contributor

What broke

Every generated page on api.goauthentik.io renders a Docusaurus error overlay instead of content:

Hook k is called outside the <ColorModeProvider>. Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.

The site has 1139 generated reference pages and the fault is in a component all of them share, so the whole reference is down, and has been since 2026-07-14. Hand-authored pages on the same site are fine, and docs.goauthentik.io and integrations.goauthentik.io were never affected.

Why

@docusaurus/theme-common is where ColorModeContext lives. Two copies of it were resolvable in the same tree, so theme-classic rendered its provider into one context object while the OpenAPI theme's components read a different one. The hook found nothing and threw.

The second copy arrived with #24000. That group bump moved eleven packages from 3.10.1 to 3.10.2 and left @docusaurus/theme-common and @docusaurus/types at ^3.10.1. The old range still admits the old resolution, so pnpm kept 3.10.1 in the lockfile:

Path Version
website/node_modules/@docusaurus/theme-common 3.10.2
website/node_modules/@docusaurus/theme-classic 3.10.2
website/api/node_modules/@docusaurus/theme-common 3.10.1
website/node_modules/docusaurus-theme-openapi-docs/node_modules/@docusaurus/theme-common 3.10.1

The SSR build succeeds either way, which is why CI stayed green and the break only showed up in a browser.

The commits

Three, separable on purpose. The first fixes the outage on its own if you would rather not take the other two.

1. website: fix ColorModeProvider crash on API reference pages — aligns the four stale specifiers and the matching override, and regenerates the lockfile. One theme-common again.

2. website: guard theme-common against a second copy — @goauthentik/docusaurus-theme imports useColorMode, ColorMode and ThemeClassNames from theme-common across five files without declaring it, surviving on the hoisted linker. Now declared. The override was also keyed on @goauthentik/docusaurus-config, which website reaches through link:../../packages/docusaurus-config. That path sits outside the workspace, so its version had to be hand-synced with website's own manifests. Rekeyed unscoped.

3. website: move the Docusaurus versions into the pnpm catalog — eleven @docusaurus/* packages, several declared in three or four manifests, now stated once and referenced as catalog:. A group bump lands everywhere or nowhere.

Verification

Reproduced first, on a production build of the pre-fix tree, then confirmed against a production build of the fix. Four reference pages sampled, headless Chromium, console captured:

Page Before After
/reference/core-users-set-password-hash-create/ crash ok
/reference/core-groups-create/ crash ok
/reference/admin-apps-list/ crash ok
/reference/flows-instances-list/ crash ok
/ (hand-authored) ok ok

The reproduction reports Hook k, matching the issue exactly.

Also run: production builds of all three sites pass; pnpm install --frozen-lockfile from a cleared node_modules passes; make lint-catalogs passes; the live sites confirm which ones were affected, with api.goauthentik.io throwing and docs and integrations clean.

Two things for maintainers

pnpm dedupe --check fails on this branch, but it also fails on main and with a longer list. Before: esprima, gray-matter, js-yaml, shell-quote, sprintf-js. After: @types/hast and shell-quote. Pre-existing, and smaller now.

website/docs fails check-types with three errors about Config resolving from both website/node_modules/@docusaurus/types and a 3.10.1 copy under packages/docusaurus-config. Also pre-existing and reproducible on main, so it is left alone here, but it is the same split-resolution shape across the root and website workspaces and probably wants its own fix.

Peer ranges in packages/docusaurus-config stay at ^3.10.1 deliberately. They are a compatibility floor, only consumed by JSDoc @import types, and dependabot/dependabot-core#1242 has been open since 2019, so Dependabot would not bump them either way.

Closes #24026


Disclosure

Triaged and authored end-to-end by an AI agent running in a sandboxed container. A human reviewed the diff and the reasoning before submission.

GirlBossRush and others added 3 commits July 21, 2026 16:11
Every generated page on api.goauthentik.io renders a Docusaurus error
overlay instead of content: "Hook k is called outside the
<ColorModeProvider>".

The docusaurus group bump in #24000 moved eleven packages from 3.10.1 to
3.10.2 but left @docusaurus/theme-common and @docusaurus/types behind at
^3.10.1. That range still admits the older resolution, so pnpm kept
3.10.1 in the lockfile and website/api ended up with a second copy of
theme-common nested under itself and under docusaurus-theme-openapi-docs.

theme-common is where ColorModeContext is defined. theme-classic renders
its provider from the hoisted 3.10.2 copy while the OpenAPI theme's
components call useColorMode from the 3.10.1 copy, so the hook reads a
context object that was never populated and throws. The SSR build
succeeds either way, which is why this only ever showed up in a browser.

Aligning the four stale specifiers and the matching override collapses
the tree back to a single theme-common. Verified against a production
build: the four reference pages that previously threw now load clean and
the hand-authored landing page is unaffected. docs.goauthentik.io and
integrations.goauthentik.io never carried a second copy and were never
affected.

Closes #24026

Co-Authored-By: Agent (authentik-i24026-aligned-educational-pine) <[email protected]>
Two things kept the duplicate resolution reachable after the version
alignment.

@goauthentik/docusaurus-theme imports useColorMode, ColorMode and
ThemeClassNames from @docusaurus/theme-common across five files but never
declared the dependency. It resolved anyway because the website workspace
uses pnpm's hoisted linker, so the shared theme package was picking up
whatever copy happened to land at the root. Declaring it makes the
resolution the theme actually relies on an explicit one.

The override was keyed on @goauthentik/docusaurus-config, which website
consumes through link:../../packages/docusaurus-config. That path leaves
the website workspace, and the version it restated there had to be kept
in step with website's own manifests by hand. Rekeying it unscoped drops
the second copy of the version and covers every member and transitive
peer rather than one linked package.

Worth recording for whoever picks up the Dependabot side: peer ranges in
packages/docusaurus-config stay at ^3.10.1 deliberately. They are a
compatibility floor, they are only consumed by JSDoc @import types, and
dependabot-core#1242 has been open since 2019, so Dependabot would never
bump them regardless.

Co-Authored-By: Agent (authentik-i24026-aligned-educational-pine) <[email protected]>
The Docusaurus packages ship as one lockstep release, and eleven of them
are declared across api, docs, integrations and docusaurus-theme, several
in three or four manifests at once. Nothing tied those declarations
together, so a group bump only had to miss one to leave two versions of a
package resolvable in the same tree. #24026 is what that looks like when
the package owns a React context.

Each version now lives once, in the catalog, and every member references
it as catalog:. Dependabot has supported catalog entries since the
February 2025 GA, so bumps keep arriving as before and land on all four
manifests together rather than on whichever subset the group happened to
match.

The theme-common override reads catalog: too, which is why its importer
entries record ^3.10.2 instead of catalog: — the override resolves first
and pnpm writes the specifier it actually applied. The version is still
stated once. Verified with pnpm install --frozen-lockfile from a cleared
node_modules, which is the check that would catch a catalog and lockfile
that had drifted apart.

Co-Authored-By: Agent (authentik-i24026-aligned-educational-pine) <[email protected]>
@GirlBossRush
GirlBossRush requested a review from a team as a code owner July 21, 2026 16:51
@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 1a1db66
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a5fa4d3c07e050008492c71
😎 Deploy Preview https://deploy-preview-24261--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 1a1db66
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a5fa4d3c07e050008492c73
😎 Deploy Preview https://deploy-preview-24261--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.47%. Comparing base (58db876) to head (1a1db66).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24261      +/-   ##
==========================================
- Coverage   93.50%   93.47%   -0.03%     
==========================================
  Files        1062     1062              
  Lines       63848    63848              
  Branches      424      424              
==========================================
- Hits        59698    59679      -19     
- Misses       4150     4169      +19     
Flag Coverage Δ
conformance 35.50% <ø> (+<0.01%) ⬆️
e2e 40.46% <ø> (+0.51%) ⬆️
integration 31.54% <ø> (-0.47%) ⬇️
rust 0.00% <ø> (ø)
unit 92.70% <ø> (ø)
unit-migrate 92.71% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-1a1db66921956dbc07a484ab1bcadc1751a1becd
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-1a1db66921956dbc07a484ab1bcadc1751a1becd

Afterwards, run the upgrade commands from the latest release notes.

@GirlBossRush
GirlBossRush enabled auto-merge (squash) July 21, 2026 17:37
@GirlBossRush
GirlBossRush merged commit d79ff6f into main Jul 21, 2026
122 checks passed
@GirlBossRush
GirlBossRush deleted the fix/24026-colormode-duplicate-theme-common branch July 21, 2026 17:39
kensternberg-authentik added a commit that referenced this pull request Jul 22, 2026
* main: (152 commits)
  web/bug: harmonize and make routine the display of schedules, part 2: Description lists (#23856)
  web: exclude dependabot-materialized link deps from workspace glob (#24297)
  core: fix object attributes not setting allow_blank (#24298)
  web: add build start/end log to build script (#24296)
  root: fix CODEOWNERS paths (#24259)
  core: object attributes - minor fixes (#24292)
  core: bump thiserror from 2.0.18 to 2.0.19 (#24281)
  core: bump serde from 1.0.228 to 1.0.229 (#24282)
  website/docs: update release notes for 2026.5.6 (#24293)
  ci: bump actions/setup-python from 6.3.0 to 7.0.0 in /.github/actions/setup (#24286)
  core, web: update translations (#24276)
  core: bump github.com/getsentry/sentry-go from 0.47.0 to 0.48.0 (#24277)
  core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /lifecycle/container (#24278)
  core: bump msgraph-sdk from 1.58.0 to 1.59.2 (#24279)
  core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /website (#24280)
  core: bump serde_repr from 0.1.20 to 0.1.21 (#24283)
  core: bump futures from 0.3.32 to 0.3.33 (#24284)
  website: fix ColorModeProvider crash on API reference pages (#24261)
  website/docs: add conn_options deprecation to 2026.5 release notes (#23882)
  website/integrations: Zammad: cleanup (#23621)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 22, 2026
* main: (154 commits)
  web/bug: harmonize and make routine the display of tasks (part 6: sch… (#23859)
  web/maint: upgrade ak-toggle-group (#24038)
  web/bug: harmonize and make routine the display of schedules, part 2: Description lists (#23856)
  web: exclude dependabot-materialized link deps from workspace glob (#24297)
  core: fix object attributes not setting allow_blank (#24298)
  web: add build start/end log to build script (#24296)
  root: fix CODEOWNERS paths (#24259)
  core: object attributes - minor fixes (#24292)
  core: bump thiserror from 2.0.18 to 2.0.19 (#24281)
  core: bump serde from 1.0.228 to 1.0.229 (#24282)
  website/docs: update release notes for 2026.5.6 (#24293)
  ci: bump actions/setup-python from 6.3.0 to 7.0.0 in /.github/actions/setup (#24286)
  core, web: update translations (#24276)
  core: bump github.com/getsentry/sentry-go from 0.47.0 to 0.48.0 (#24277)
  core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /lifecycle/container (#24278)
  core: bump msgraph-sdk from 1.58.0 to 1.59.2 (#24279)
  core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /website (#24280)
  core: bump serde_repr from 0.1.20 to 0.1.21 (#24283)
  core: bump futures from 0.3.32 to 0.3.33 (#24284)
  website: fix ColorModeProvider crash on API reference pages (#24261)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 22, 2026
* main: (99 commits)
  web/bug: harmonize and make routine the display of tasks (part 6: sch… (#23859)
  web/maint: upgrade ak-toggle-group (#24038)
  web/bug: harmonize and make routine the display of schedules, part 2: Description lists (#23856)
  web: exclude dependabot-materialized link deps from workspace glob (#24297)
  core: fix object attributes not setting allow_blank (#24298)
  web: add build start/end log to build script (#24296)
  root: fix CODEOWNERS paths (#24259)
  core: object attributes - minor fixes (#24292)
  core: bump thiserror from 2.0.18 to 2.0.19 (#24281)
  core: bump serde from 1.0.228 to 1.0.229 (#24282)
  website/docs: update release notes for 2026.5.6 (#24293)
  ci: bump actions/setup-python from 6.3.0 to 7.0.0 in /.github/actions/setup (#24286)
  core, web: update translations (#24276)
  core: bump github.com/getsentry/sentry-go from 0.47.0 to 0.48.0 (#24277)
  core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /lifecycle/container (#24278)
  core: bump msgraph-sdk from 1.58.0 to 1.59.2 (#24279)
  core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /website (#24280)
  core: bump serde_repr from 0.1.20 to 0.1.21 (#24283)
  core: bump futures from 0.3.32 to 0.3.33 (#24284)
  website: fix ColorModeProvider crash on API reference pages (#24261)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API reference for core-users-set-password-hash-create crashing

3 participants