Skip to content

Console organization invitations: "Invitation not found!" and "User is already a member of this organization" render as raw English, and an already-accepted invitation reads as 「邀请不可用」 #33650

Closed

Description

@os-bob

维护者速读

组织邀请链路上的两个报错没有本地化,中文界面里直接显示 better-auth 的英文原文:

  1. 打开 /accept-invitation/<id> 时显示 「邀请不可用」+ "Invitation not found!"。控制台本来已经为这个情况准备了中文「该邀请已失效或已过期。」,但没匹配上。
  2. 邀请成员弹窗里显示 "User is already a member of this organization":这个错误码没有映射。

另外,已经接受过的邀请再次打开链接(或接受后刷新页面),看到的也是「邀请不可用」。被邀请人其实已经在组织里了,应该提示「你已加入该组织」并带他进去,而不是看起来像出错。

Facts (objectstack main, better-auth 1.7.12, 2026-11-15)

  • Why (1) is untranslated. better-auth's GET /organization/get-invitation (dist/plugins/organization/routes/crud-invites.mjs:503) throws APIError.fromStatus("BAD_REQUEST", { message: "Invitation not found!" }), with no code. Unlike accept-invitation (L268), it does not use ORGANIZATION_ERROR_CODES.INVITATION_NOT_FOUND. resolveOrgErrorMessage (ui/packages/app-shell/src/console/organizations/orgErrorMessage.ts:180) looks up by code first, so the existing INVITATION_NOT_FOUND entry (L141) is never hit. It then returns err.message as is, and the page's own localized fallback (AcceptInvitationPage.tsx:83) is never reached because the message is non-empty.
  • One message, six states. That throw covers: unknown id (typo, deleted organization, link from another environment), accepted, rejected, canceled, expired (invitation-expired-supersede.ts), and expiresAt in the past (default 48 h, invitationExpiresIn unset). The page cannot tell them apart.
  • Why (2) is untranslated. USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION is missing from ORG_ERROR_MESSAGE_KEYS (invite-path section, L88–100), so the invite dialog draws the vendor's English message.
  • Observed together: inviting zhang.wei@… answered "User is already a member of this organization", and opening that person's earlier invitation link answered "Invitation not found!". The invitation had already been accepted.

Expected

  • Both errors are drawn in the console's language: 「该邀请已失效或已过期。」 and a localized "already a member" sentence.
  • When the signed-in user opening the link is already a member of the invitation's organization, the page says so and offers to enter that organization, instead of the error card.

Suggested fix

  1. In resolveOrgErrorMessage (or the @object-ui/auth client's getInvitation), treat the code-less "Invitation not found!" from get-invitation as INVITATION_NOT_FOUND, or let AcceptInvitationPage prefer its localized fallback for any get-invitation 400.
  2. Add USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION to ORG_ERROR_MESSAGE_KEYS, with i18n keys in every locale pack.
  3. On a not-found answer, check whether the current user already belongs to an organization the console knows about for this invitation, and show the "already joined" state. If the id alone cannot tell, at least word the error so it covers the accepted case ("已被使用、已过期或已撤销").

Activity

  1. added
    bug
    domain:ui
    area:identity
    area:i18n
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:ui · p2 · 2026-11-15T04:47Z

    ⛔ Not a claim.

    Two invitation errors render better-auth's raw English in the Chinese console, and an already-accepted invitation reads as unavailable. On its own that is copy (p3). It is on the hosted onboarding path real customers walk (cloud#4465), so it is raised once to p2.

  3. added
    pm:queue
    priority:p2
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

    Claim: PM loop round 1 · 2026-11-15T05:06Z
    Session: session_01FEkQ5nwxuShQ1A7T6jAiLn (card thread, dev) · seat session_01FEkQ5nWoa1Ze1QzjRTSYXD
    Account: os-project-manager
    Branch: claude/project-thread-9og97o
    Worktree: objectstack-issue-33650
    Domain: domain:ui
    Seat: domain:ui#1
    File surface: ui/packages/app-shell/src/console/organizations/orgErrorMessage.ts, AcceptInvitationPage.tsx, the invite dialog, @object-ui/i18n locale packs (one key per new code, every shipped locale), their tests, root .changeset/. ⛔ No spec, server, packages/** or better-auth patch.
    Container & model: S, mode:thread, model: default tier, effort: default
    Clause-②: no
    Metadata-protocol: none
    Responsibility: a person opening an invitation link, or an admin inviting someone already in the organization, reads better-auth's raw English and an accepted invitation reads as an error | none (no data changes) | every Console user on the organization invitation path in a non-English locale
    Thread-read: 6889355499
    Premise: read on better-auth 1.7.12 and the console code by the card's author (card body, 2026-11-15); the dev measures each face on origin/main first
    Serial constraints cleared: no other pm:dispatched domain:ui card claims a file in this surface (live label read); no other ui seat holds a Claim: on these files

    Scope: the card's three faces, one PR, Fixes #33650. p2, raised by triage 6889355499 (hosted onboarding path). The declaration lines start at no / none; the dev measures them on the diff, and the seat amends this claim if they differ. Order: /mnt/project-files/pm-orders/ui/order-33650.md. Summons: the maintainer's 「开一个 ui 车道,派发 p1 p2 任务」 (this project, 2026-11-14T14:13Z) and 「后续只处理 p1 p2」 (this project, 2026-11-15T05:05Z).

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  6. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

    Claim amendment · 2026-11-15T05:08Z
    File surface adds: ui/packages/auth/src/createAuthClient.ts (toAuthError carries the response status on the thrown error, as the file's two-factor and invitation-preview errors already do) and its test under ui/packages/auth/src/__tests__/. The changeset also names @object-ui/auth.
    Why: better-auth 1.7.12's get-invitation not-found answer carries no code, and orgErrorMessage.ts refuses English-text matching (objectui#4474), so the narrowest key is route + status 400 + no code, and the page cannot see the status today.
    Clause-②: starts at no. If a published type gains a member (e.g. status on an exported error type), the dev reports yes (widening), and a TIER_DEFAULT contract record is owed on the head before landing.
    Metadata-protocol: none (unchanged).

  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#1 · os-project-manager · session_01FEkQ5nwxuShQ1A7T6jAiLn
    os-dev-report
    {
    "issue": 33650,
    "status": "done",
    "branch": "claude/project-thread-9og97o",
    "pr": "#33679",
    "session": "session_01FEkQ5nwxuShQ1A7T6jAiLn",
    "premise_still_valid": true,
    "summary": "All three faces reproduce on origin/main 3c0033f through the real page and dialog over the real auth client with better-auth 1.7.12's own bodies. Fix: (1) @object-ui/auth toAuthError now carries the HTTP status, and the new resolveInvitationLookupMessage (orgErrorMessage.ts, called only from AcceptInvitationPage's getInvitation catch) reads a 400 with no code as the localized not-found sentence, never the English text; (2) USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION maps to organization.errors.alreadyMember in all 11 packs (10 hand-written + generated zh-Hant); (3) the already-accepted state cannot be told from the id (get-invitation refuses every non-pending row with the same code-less 400, list-user-invitations filters to pending, invitation-preview is uniform 404 by ADR-0138 D2), so per the order the not-found sentence now names used / expired / revoked and points to the organization list beside the existing Go to organizations button; the gap is in out_of_scope_findings. The card's assignee was empty at my read and I wrote none, per os-dev rule 2. Surface amended by the seat (claim amendment 6889564701) to add ui/packages/auth/src/createAuthClient.ts and its test.",
    "tests": "Head 2c55521: new pins invitationVendorRefusals-33650.test.tsx (9) + authErrorStatus-33650.test.ts (2): Test Files 2 passed, Tests 11 passed. Base measurement (production sources at 3c0033f, tests kept, restored with git checkout HEAD --, git diff HEAD empty): 7 failed | 4 passed, the 4 passing are the CONTROLs; drawn text on base: face 1 'Invitation not found!' (zh and en), face 3 'Invitation not found!', face 2 'User is already a member of this organization'. Affected suites (vitest run packages/auth/ packages/i18n/ packages/app-shell/src/console/organizations/ packages/app-shell/src/console/auth/ apps/console/src/pages/auth/): first run 1 failed | 2972 passed | 13 skipped (orgErrorMessage-4474 mapping-table census lists every mapped code), census updated in 2c55521, rerun of that file 21/21 passed. Type-check: @object-ui/auth, @object-ui/app-shell (tsc --noEmit + tsconfig.test.json), @object-ui/i18n all exit 0 after the app-shell^... build. Ablations via scripts/ablation-replace.mjs (ui vitest reads these packages from source, no dist leg), each restored to the HEAD blob: A1 lookup guard forced false -> 3 red (face 1 zh/en, face 3); A2 status narrowing removed -> 1 red (CONTROL code-less 401); A3 status copy forced off -> 5 red (both auth pins, face 1 zh/en, face 3); A4 already-member row unkeyed -> 1 red (face 2). The first A3 attempt was refused before running (anchor ambiguous, exit 3, nothing mutated), rerun with a three-line anchor.",
    "gates": "Local: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 39 families at 2c55521; all 39 ran exit 0 (exit codes captured by redirect before any pipe; list in /mnt/project-files/pm-orders/ui/33650-gates-ran.txt and the PR body); --ran reconciliation: 39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN. Type-check lanes above. CI check-runs: in_progress at report time (PR opened 06:01Z), not re-run locally.",
    "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
    "mcp_calls": "3 — mcp__github__issue_read (get, get_comments x2); no MCP writes",
    "api_writes": "3 — git push (branch claude/project-thread-9og97o), relay pr_create (#33679, dispatch run 43683563253), this os-dev-report comment on #33650 via post-stamped.mjs",
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "class: a · reach: GET /api/v1/auth/organization/get-invitation?id=ID by the signed-in invitee of an invitation they already accepted answers 400 { message: 'Invitation not found!' } with no code, identical to an unknown id (better-auth 1.7.12 crud-invites.mjs getInvitation: any status but pending), so the console cannot show 'you have joined ORG' with a way in, which #33650 expects · evidence: crud-invites.mjs getInvitation; list-user-invitations filters to pending (crud-invites.mjs listUserInvitations); objectstack invitation-preview answers one uniform 404 by design (ADR-0138 D2, signed-out); the console now words the sentence to cover the accepted case (PR #33679). A server card would give the signed-in RECIPIENT (email match) a distinguishable answer, e.g. a coded refusal naming the invitation as already accepted plus its organization id, without changing the signed-out preview · dedupe words: get-invitation accepted invitation, already joined organization, invitation not found accepted, invitee reopens link",
    "carrier: none · noted, not filed: the same code-less 400 is folded for expired / rejected / canceled rows; the console's sentence names all of them, so no further console work is owed there"
    ]
    }


    Generated by Claude Code

  8. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

    Claim amendment · 2026-11-15T06:08Z
    Clause-②: yes (widening), measured on PR #33679 (head 0c5eed2c). @object-ui/i18n gains organization.errors.alreadyMember in all eleven packs. Errors thrown by @object-ui/auth gain a numeric status beside message and code. Nothing is removed or narrowed, and no exported type changes. This is the same reading as #33103 / PR #33485 and #33498 / PR #33585.
    Metadata-protocol: none (unchanged).
    A TIER_DEFAULT contract record (declaration face) is owed on the head before landing. os-dev-report: 6890090496.

  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

    Landed · 2026-11-15T07:20Z

    reading value
    PR #33679 MERGED as 5604aeb0 on main (closes this card via Fixes #33650)
    contract record PASS 6890217201

    State: pm:dispatched removed, assignee cleared; card closed by the merge.
    Follow-up: the server answer for an already-accepted invitation is #33681.

  10. removed
    pm:dispatched
    on Nov 15, 2026
  11. added a commit that references this issue on Nov 16, 2026
    5604aeb
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

    area:i18narea:identitybugdomain:uipriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions