BloopAI/vibe-kanban · error

Migration DB pool error: {}

Error message

Migration DB pool error: {}

What it means

migrate_execution_logs_to_files opens a dedicated SQLite migration pool before copying execution logs to files. If the pool cannot be created (database file missing, locked, permissions, bad URL), the underlying error is wrapped in this message and the migration aborts.

Source

Thrown at crates/services/src/services/execution_process.rs:33

use futures::{StreamExt, TryStreamExt};
use indicatif::{ProgressBar, ProgressStyle};
use sqlx::SqlitePool;
use tokio::{io::AsyncWriteExt, sync::RwLock, task::JoinHandle};
use utils::{
    assets::prod_asset_dir_path,
    execution_logs::{
        ExecutionLogWriter, process_log_file_path, process_log_file_path_in_root,
        read_execution_log_file,
    },
    log_msg::LogMsg,
    msg_store::MsgStore,
};
use uuid::Uuid;

pub async fn migrate_execution_logs_to_files() -> Result<()> {
    let pool = DBService::new_migration_pool()
        .await
        .map_err(|e| anyhow::anyhow!("Migration DB pool error: {}", e))?;

    if !ExecutionProcessLogs::has_any(&pool).await? {
        return Ok(());
    }

    let is_tty = std::io::stderr().is_terminal();
    if is_tty {
        let _ = writeln!(
            std::io::stderr(),
            "Performing one time database migration to move logs from SQLite to flat file to improve performance, data remains local, may take a few minutes, please don't exit while this process is running..."
        );
    }

    let pb = if is_tty {
        Some(new_spinner("Migrating"))
    } else {
        None
    };

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Check the inner error text (after 'Migration DB pool error:') for the real cause (locked, no such file, permission denied).
  2. Stop other app instances that may hold the SQLite lock, then retry the migration.
  3. Verify the DB path/env var points at the existing database file.
  4. Fix filesystem permissions on the DB file and its directory, and ensure the disk isn't full.

Example fix

// before
DATABASE_URL=sqlite:///old/path/vibe.db
// after
DATABASE_URL=sqlite:///correct/data/dir/vibe.db  # and ensure no other instance is running
Defensive patterns

Strategy: try-catch

Validate before calling

// before running migration
let db_path = std::env::var("DATABASE_URL")?;
if !Path::new(&db_path.trim_start_matches("sqlite://")).exists() {
    anyhow::bail!("database file missing at {}", db_path);
}

Try / catch

match migrate_execution_logs_to_files().await {
    Err(e) if e.to_string().starts_with("Migration DB pool error") => {
        eprintln!("fix DB path/lock and retry: {e}");
        // e.g. stop other instances, then retry once
    }
    other => other,
}

Prevention

When it happens

Trigger: Running the log-file migration (startup/upgrade path) when DBService::new_migration_pool fails — bad DATABASE_URL, missing/moved SQLite file, another process holding the DB lock, or read-only filesystem.

Common situations: Upgrading the app while another instance is still running and locking the DB; moving the data directory without updating the DB path env; permission changes after an OS update; disk full.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/b6d66f78e4cff390. Report an issue: GitHub.