Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

CLI crashes with "ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint" after switching from nightly back to stable

Abierto
#1,611 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@sentry-junior ya está trabajando en esto.

Desde el 23/10/2026.

  • #1612 de @sentry-junior — abierto

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
Área
cli, database

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
  • sentry CLI stable [email protected], installed as a Bun global (install.method bun in cli.db)
  • Previously ran nightly 0.48.0-dev.1792585391, which migrated ~/.config/sentry/cli.db to schema_version 19
  • Linux 6.18, Bun 1.4.4, sentry.io SaaS, one org with two projects
Steps to Reproduce
  1. sentry cli upgrade nightly, then run any authenticated command (the DB migrates to schema 19).
  2. sentry cli upgrade stable (or reinstall [email protected]).
  3. 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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de getsentry/toolkit

Todos los issues de getsentry/toolkit

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.