thedotmack/claude-mem · info

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

Error message

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

What it means

During the column-rename migration, `safeRenameColumn(table, oldCol, newCol)` inspects PRAGMA table_info. If the new column already exists it silently skips; if the old column exists it renames; when neither exists it logs this warning and returns false. It flags a schema generation the migration does not recognize — usually benign.

Source

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

    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 8bc631a71a)

Solutions

  1. Usually safe to ignore — there is nothing to rename for that schema generation.
  2. If sessions fail to link, run `PRAGMA table_info(sdk_sessions)` and compare with the expected schema.
  3. As a last resort on a non-critical machine, rebuild the local index (uninstall/reinstall).
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: A table (sdk_sessions, pending_messages, observations, session_summaries) exists but contains neither the legacy column (e.g. claude_session_id) nor its replacement (content_session_id) — a schema older than the rename or one that never had the column.

Common situations: Databases created by very old versions, restored or partially-migrated data files, or schema drift from manual edits.

Related errors


AI-assisted analysis of thedotmack/claude-mem@8bc631a71a (2026-08-20). Data as JSON: /api/errors/03410d5ce50bade1. Report an issue: GitHub.