Skip to content

GitHub OAuth login fails with "Failed query: update user" — email param comes back empty #39207

Description

@asmartin-ai

Description

Signing into opencode.ai via "Continue with GitHub" fails at the OAuth callback with a server-side SQL error. The account_id resolves correctly, but the email parameter being written is empty, which breaks the update.

Redirected to:
https://opencode.ai/auth/callback?error=server_error&error_description=Failed+query%3A+update+%60user%60+set+%60account_id%60+%3D+%3F%2C+%60email%60+%3D+%3F+where+%60user%60.%60email%60+%3D+%3F...

Rendered error:
{"error":"No authorization code found.","cause":{"error":"server_error","error_description":"Failed query: update user set account_id = ?, email = ? where user.email = ?\nparams: acc_01KWSQEYZ942CFSMVGE47NQX7P,,asmartin.ai.dev@gmail.com"}}

Note the second bound param (the new email to SET) is empty — only account_id and the WHERE-clause email are populated.

Steps to reproduce

  1. Go to opencode.ai and click "Continue with GitHub"
  2. Authorize the GitHub OAuth app
  3. Get redirected back to /auth/callback with the server_error above

Troubleshooting already tried (did not help)

  • Revoked opencode's prior GitHub OAuth grant and re-authorized fresh
  • Revoked/removed any Google-linked opencode authorization for the same email
  • Retried after all of the above — identical error, same account_id, same empty email param

This suggests the bug is server-side in how opencode resolves/writes the email from GitHub's OAuth response, not an account-state issue on the user's end (related to #35150, which hit "emails.find is not a function" in the same callback path).

Operating System

Windows 10

OpenCode version

N/A (web signup flow, not CLI)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions