thedotmack/claude-mem · info

Column not found in , skipping rename

Error message

Column ${oldCol} not found in ${table}, skipping rename

What it means

SessionStore performs idempotent schema migrations that rename legacy columns in sdk_sessions (claude_session_id→content_session_id, sdk_session_id→memory_session_id). safeRenameColumn checks column existence first; when the old column is absent the rename is skipped with this warning and returns false (so renamesPerformed is not incremented). This is expected on fresh databases or already-migrated schemas — not an error.

Solutions

  1. No action needed — the migration is idempotent and the warning confirms the rename was unnecessary
  2. If you expected the old columns to exist, verify the database file being opened is the right one (~/.claude-mem/claude-mem.db) and not a freshly created one
  3. Check prior migration logs (renamesPerformed counter) to confirm the rename already happened
Defensive patterns

Strategy: type-guard

Validate before calling

const cols = db.prepare(`PRAGMA table_info(sdk_sessions)`).all().map(c => c.name);
const needsRename = cols.includes('claude_session_id');

Type guard

function hasColumn(db: Database, table: string, col: string): boolean {
  return db.prepare(`PRAGMA table_info(${table})`).all()
    .some((c: { name: string }) => c.name === col);
}

Try / catch

if (hasColumn(db, 'sdk_sessions', 'claude_session_id')) {
  db.run(`ALTER TABLE sdk_sessions RENAME COLUMN claude_session_id TO content_session_id`);
} // else: skip silently — already migrated

Prevention

When it happens

Trigger: SessionStore migration runs safeRenameColumn for a table where PRAGMA/table-info shows the old column does not exist — fresh DB created directly with the new schema, or the rename was already applied in a prior run.

Common situations: First run after upgrading where the migration already completed on another start; brand-new database that never had the legacy columns; restoring a DB backup from a newer schema.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/03410d5ce50bade1. Report an issue: GitHub.

Appendix: source

Thrown at src/services/sqlite/SessionStore.ts:1572

    let renamesPerformed = 0;

    const safeRenameColumn = (table: string, oldCol: string, newCol: string): boolean => {
      const tableInfo = this.db.query(`PRAGMA table_info(${table})`).all() as TableColumnInfo[];
      const hasOldCol = tableInfo.some(col => col.name === oldCol);
      const hasNewCol = tableInfo.some(col => col.name === newCol);

      if (hasNewCol) {
        return false;
      }

      if (hasOldCol) {
        this.db.run(`ALTER TABLE ${table} RENAME COLUMN ${oldCol} TO ${newCol}`);
        logger.debug('DB', `Renamed ${table}.${oldCol} to ${newCol}`);
        return true;
      }

      logger.warn('DB', `Column ${oldCol} not found in ${table}, skipping rename`);
      return false;
    };

    if (safeRenameColumn('sdk_sessions', 'claude_session_id', 'content_session_id')) renamesPerformed++;
    if (safeRenameColumn('sdk_sessions', 'sdk_session_id', 'memory_session_id')) renamesPerformed++;

    if (safeRenameColumn('pending_messages', 'claude_session_id', 'content_session_id')) renamesPerformed++;

    if (safeRenameColumn('observations', 'sdk_session_id', 'memory_session_id')) renamesPerformed++;

    if (safeRenameColumn('session_summaries', 'sdk_session_id', 'memory_session_id')) renamesPerformed++;

    if (safeRenameColumn('user_prompts', 'claude_session_id', 'content_session_id')) renamesPerformed++;

    this.db.prepare('INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)').run(17, new Date().toISOString());

    if (renamesPerformed > 0) {
      logger.debug('DB', `Successfully renamed ${renamesPerformed} session ID columns`);

View on GitHub (pinned to d8bc9755e7)