CLI crashes with "ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint" after switching from nightly back to stable
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- bun, sqlite, typescript
调研方向
Start with packages/cli/src/lib/db/schema.ts and trace initSchema, the org_regions upsert, and sentry cli fix; the report also points to hasCompositePrimaryKey for pagination_cursors. Reproduce by migrating the CLI database to schema 19, then running stable 0.47.0 against an organization list. Done means the version mismatch is detected and handled with a clear recovery path, and the reported crash no longer occurs.
由索引模型根据 Issue 内容生成。
描述
Environment
sentryCLI stable[email protected], installed as a Bun global (install.method bunincli.db)- Previously ran nightly
0.48.0-dev.1792585391, which migrated~/.config/sentry/cli.dbtoschema_version19 - Linux 6.18, Bun 1.4.4, sentry.io SaaS, one org with two projects
Steps to Reproduce
sentry cli upgrade nightly, then run any authenticated command (the DB migrates to schema 19).sentry cli upgrade stable(or reinstall[email protected]).sentry issue view <SHORT-ID>for an issue in a project the local DSN does not match, so the CLI has to list organizations.
Expected Result
sentry cli upgrade stable is the documented way back from nightly, so stable should cope with a DB from a newer schema: rebuild the cache tables, or refuse with a message saying what to do. sentry cli fix should catch the mismatch.
Actual Result
$ sentry issue view WEB-14 --json --fields shortId --log-level trace
[http] GET /api/0/organizations/ -> 200 (814ms)
Unexpected error: Error: ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint
After the nightly, org_regions has PRIMARY KEY (credential_identity, source_origin, org_slug) (packages/cli/src/lib/db/schema.ts, added for multi-account auth in #1526/#1528). 0.47.0 is schema 16 and upserts org_regions with ON CONFLICT(org_slug), which SQLite rejects. Short IDs resolved through the DSN shortcut never touch that table and keep working, so the failure looks random.
initSchema only migrates when currentVersion < CURRENT_SCHEMA_VERSION, so nothing notices a newer DB, including on main. sentry cli fix prints Schema version: 16 ... No issues found (the binary's version) while select version from schema_version returns 19. It could compare each table's primary key with the declared schema; hasCompositePrimaryKey already exists for pagination_cursors.
Workaround: drop and recreate org_regions (a cache table), or delete cli.db and log in again.
- 主要语言
- TypeScript
- 星标
- 938
- 派生
- 166
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 156
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/toolkit 的其他 Issue
-
bug MCP
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/toolkit#1600 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
getsentry/toolkit#1471 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement MCP
难度 4/5 1-2 天 新手友好度 55/100
getsentry/toolkit#1601 · 1 条评论 ·
维护者通常 1 天内回复
-
Use typed detector schemas from @sentry/api for metric monitors可能已有人在做 @MathurAditya724 于 1 天前认领。 未关闭
getsentry/toolkit#1595 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 43/100
getsentry/toolkit#1564 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/toolkit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
lyswhut/lx-music-desktop#3026 ·
-
area: ci type: test
难度 2/5 1-3 小时 新手友好度 65/100
schlessera/brain-kit#2769 ·
维护者通常 1 天内回复
-
Read a vector index's quantization back on Neo4j 2026.10, which reports vector.quantization.type未关闭
难度 2/5 1-3 小时 新手友好度 78/100
liberation-data/drivine#231 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
alveusgg/alveusgg#2502 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复