[Bug]: current_local_runtime_v2_migration_failed — corrupt runtime-state.sqlite blocks startup
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- sqlite, typescript
Hướng nghiên cứu
Start by reading packages/local-runtime/src/persistence/migration/v2-migration.ts and packages/local-runtime/src/persistence/db.ts to follow how startup opens and migrates the runtime-state database. Check the existing backup and path handling in packages/local-runtime-v2/src/infra/db/backup.ts and packages/shared/src/local-runtime-paths.ts; the issue names no tests, so locate the relevant migration tests. Done means corrupt databases no longer block startup without recovery or an actionable error, and session history files remain untouched.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Starting MCode fails with a fatal, unrecoverable startup error. The local runtime-state SQLite database is reported as malformed, so the v1→v2 migration step that opens it throws, no session can be loaded, and the CLI stays unusable until the file is removed by hand.
Product or interface
CLI - interactive TUI
Version
v0.7.4 (MiniMax Code app version shown in the screenshot; mcode --version output to be added)
Platform
Linux (workspace path style ~/workspaces/<project>; uname -srm to be confirmed)
OS version and architecture
To be confirmed (uname -srm)
Issue area
Startup / install / update
Desktop log upload ID
N/A - CLI report.
Steps to reproduce
- Start MCode in a workspace:
cd <workspace> && mcode - The TUI renders the welcome banner and shows
Loading session - Startup then aborts with the error below; the session is never loaded and the TUI remains unusable
- Every subsequent start reproduces the same error
Expected and actual behavior
Expected: When the runtime-state database cannot be opened (corrupt / not a database), MCode should recover — for example quarantine the unreadable file, rebuild a fresh runtime-state DB and continue starting — or at minimum fail with an actionable message that contains the absolute path of the file, the SQLite error code, and the exact command that repairs it.
Actual: The only output is a raw machine-readable error code. There is no file path, no SQLite error code, no recovery hint, and no mcode command that repairs the state. The session cannot be loaded at all.
Redacted error summary
current_local_runtime_v2_migration_failed:sqlite:runtime-state:open:database disk image is malformed
It is printed at the bottom of the TUI, under the status bar ~/workspaces/<project> | Permissions | ✦ no model.
Root cause (traced in the published source)
packages/local-runtime/src/persistence/migration/v2-migration.ts:276opens the runtime-state database inside the migration stepsqlite:runtime-state:open, throughopenLocalRuntimeDb(dataDir)(packages/local-runtime/src/persistence/db.ts:516), which callsnew Database(dbPath). On a corrupt file, better-sqlite3 throwsSqliteError: database disk image is malformed(SQLITE_NOTADB / SQLITE_CORRUPT).- The step error is collected into
manifest.errors, andassertV2MigrationSucceeded()(v2-migration.ts:146-150) rethrows it ascurrent_local_runtime_v2_migration_failed:<reason>— exactly what the TUI prints. - The affected file is
<dataDir>/v2/sqlite/runtime-state.sqlite(packages/shared/src/local-runtime-paths.ts:57). The default data directory is~/.minimax(~/.minimax-<profile>when a profile is selected;MINIMAX_DATA_DIR/MAVIS_DATA_DIRoverride it). - There is no recovery path today: the pre-migration backup (
<dataDir>/v2/sqlite/backups/runtime-state-before-v2-migration-*.sqlite,packages/local-runtime-v2/src/infra/db/backup.ts:67) is produced through SQLite's online backup API, which itself requires the file to be openable. A corrupt database can therefore never be backed up, let alone repaired, and the failure is terminal for the entire data directory. - The same migration also creates the v2 database from the legacy v1 database with
VACUUM INTO(v2-migration.ts:756-771) and reconciles rows into an existing target (:750-754), so a corrupt target can also be produced by the copy/promote path rather than by external damage.
Request
- Treat an unreadable runtime-state DB as a recoverable condition: on
SQLITE_CORRUPT/SQLITE_NOTADB, move the file aside with a timestamp, recreate a fresh runtime-state DB, and continue starting. Session history is stored as files under<dataDir>/v2/sessions/, so it should survive this. - At minimum, print an actionable CLI error: the absolute DB path, the SQLite error code, and the exact command to quarantine the file.
- Consider running
PRAGMA integrity_checkon the runtime-state DB during startup, so corruption is detected before it turns into a hard startup failure. Related: #505 (SQLite WAL is never checkpointed) and #282 (SQLITE_BUSY on the shared runtime-state.sqlite).
Workaround used to get the CLI running again
# stop every MCode process first
cd ~/.minimax/v2/sqlite
mv runtime-state.sqlite runtime-state.sqlite.corrupt
[ -f runtime-state.sqlite-wal ] && mv runtime-state.sqlite-wal runtime-state.sqlite-wal.corrupt
[ -f runtime-state.sqlite-shm ] && mv runtime-state.sqlite-shm runtime-state.sqlite-shm.corrupt
This quarantines the corrupt file and lets the runtime rebuild a fresh runtime-state database. It discards the runtime-state index (message rows, queue items, asset-ref index); the session history files under <dataDir>/v2/sessions/ are not touched.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.2k
- Fork
- 281
- Merge trung bình
- 14 giờ 42 phút
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MiniMax-AI/minimax-code
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
MiniMax-AI/minimax-code#556 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MiniMax-AI/minimax-code#507 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage tui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MiniMax-AI/minimax-code#481 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug cli documentation needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
MiniMax-AI/minimax-code#299 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage question tui
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
MiniMax-AI/minimax-code#593 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của MiniMax-AI/minimax-code
Issue tương tự
-
cloudflare-cache-binding: `unstorage://` keys are rejected by the Cache API, cache never storesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 2 ngày
-
desktop: pasted image breaks and send fails with "Failed to fetch" after the clipboard temp file is deletedCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anomalyco/opencode#62052 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
strapi/design-system#2084 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày