CLI crashes with "ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint" after switching from nightly back to stable
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- bun, sqlite, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 938
- Forks
- 166
- Merge medio
- 1 d 4 h
- PR fusionados (30 d)
- 175
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/toolkit
-
bug MCP
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
getsentry/toolkit#1621 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug MCP
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
getsentry/toolkit#1618 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Docs MCP tool failures omit isErrorPosiblemente ocupada @thomasjiangcy la tomó hoy. Abiertobug MCP
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
getsentry/toolkit#1600 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
getsentry/toolkit#1471 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
CLI: Centralize target specs and lint free-text examples in fullDescriptionPosiblemente ocupada @sentry-junior la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
getsentry/toolkit#1649 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/toolkit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
farion1231/cc-switch#8829 ·
Los mantenedores suelen responder en 1 día
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverAbiertodoc-audit enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100