davila7/claude-code-templates · warning

Warning: Could not parse ${filename}:

Error message

Warning: Could not parse ${filename}:

What it means

loadConversations in ConversationAnalyzer.js failed to parse one conversation file: the per-file try/catch wraps message extraction/caching and warns, skipping that file while continuing the loop.

Source

Thrown at cli-tool/src/analytics/core/ConversationAnalyzer.js:141

            filePath: filePath,
            messageCount: parsedMessages.length,
            fileSize: stats.size,
            lastModified: stats.mtime,
            created: stats.birthtime,
            tokens: tokenUsage.total > 0 ? tokenUsage.total : this.estimateTokens(await this.getFileContent(filePath)),
            tokenUsage: tokenUsage,
            modelInfo: modelInfo,
            toolUsage: toolUsage,
            project: finalProject,
            status: stateCalculator.determineConversationStatus(parsedMessages, stats.mtime),
            conversationState: stateCalculator.determineConversationState(parsedMessages, stats.mtime),
            statusSquares: await this.getCachedStatusSquares(filePath, parsedMessages),
            // parsedMessages removed to prevent memory leak - available via cache when needed
          };

          conversations.push(conversation);
        } catch (error) {
          console.warn(chalk.yellow(`Warning: Could not parse ${filename}:`, error.message));
        }
      }

      return conversations.sort((a, b) => b.lastModified - a.lastModified);
    } catch (error) {
      console.error(chalk.red('Error loading conversations:'), error.message);
      return [];
    }
  }

  /**
   * Load active Claude projects from directory structure
   * @returns {Promise<Array>} Array of project objects
   */
  async loadActiveProjects() {
    const projects = [];

    try {

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Isolate the file named in the warning and inspect its first lines with head/jq
  2. If it's an old-format file, exclude or delete it
  3. Update the CLI/analytics package for the latest format support
  4. Ignore — other conversations still load
Defensive patterns

Strategy: try-catch

Validate before calling

// Skip files that can't be fully parsed before heavy analysis
const lines = (await fs.readFile(p,'utf8')).split('\n').filter(Boolean);
if (!lines.every(l => { try { JSON.parse(l); return true; } catch { return false; } })) continue;

Try / catch

try { conversations.push(await analyze(file)); }
catch (error) { console.warn(`Could not parse ${filename}:`, error.message); /* continue loop */ }

Prevention

When it happens

Trigger: A conversation .jsonl whose structure doesn't match expected Claude Code format (unexpected message shapes, unreadable file), or a cache/derived-computation (statusSquares) throwing for that file.

Common situations: Old/new Claude Code conversation format versions; corrupted files; files from other tools dropped into ~/.claude/projects.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/63638381e4302faf. Report an issue: GitHub.