davila7/claude-code-templates · warning

Not found

Error message

Not found

What it means

This is the Express fallback route's 404 for unmatched API/service/component/asset paths. Any GET whose path starts with /api/, /services/, /components/, or /assets/ but matches no earlier route gets this JSON 404 instead of being served the SPA HTML file.

Solutions

  1. Compare the requested path against the routes actually defined in setupRoutes (grep this.app.get/post in chats-mobile.js)
  2. If it's an asset 404, clear cache / hard-refresh so the UI reloads HTML matching the served assets
  3. Make sure you're hitting the right server/port (chats-mobile vs other local dashboards)
  4. Fix the typo or update the client to the current API path

Example fix

// before
fetch('/api/conversations/analytics'); // -> 404 { error: 'Not found' }
// after
fetch('/api/conversations/' + encodeURIComponent(id) + '/analytics');
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = ['/api/conversations', /^\/api\/conversations\/[^/]+\/analytics$/];
if (!KNOWN.some(p => typeof p === 'string' ? path === p : p.test(path))) console.warn('unmatched route', path);

Prevention

When it happens

Trigger: Calling an API endpoint that doesn't exist (typo like /api/conversation/:id/analytics, wrong prefix) or requesting a missing asset like /assets/nonexistent.js — the fallback sees the /assets/ prefix and returns 404 JSON rather than index.html.

Common situations: Version mismatch where the frontend HTML references a hashed asset that a newer/older server build doesn't ship; curl-ing an endpoint after a route rename; proxying requests to the wrong port so they hit chats-mobile instead of the intended service.

Related errors


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

Appendix: source

Thrown at cli-tool/src/chats-mobile.js:811

          error: 'Failed to fetch analytics',
          message: error.message
        });
      }
    });

    // Serve the mobile chats page as default
    this.app.get('/', (req, res) => {
      res.sendFile(path.join(__dirname, 'analytics-web', 'chats_mobile.html'));
    });

    // Fallback for any other routes (but not for API or static files)
    this.app.get('*', (req, res) => {
      // Don't redirect API calls or static files
      if (req.path.startsWith('/api/') || 
          req.path.startsWith('/services/') || 
          req.path.startsWith('/components/') || 
          req.path.startsWith('/assets/')) {
        res.status(404).json({ error: 'Not found' });
        return;
      }
      res.sendFile(path.join(__dirname, 'analytics-web', 'chats_mobile.html'));
    });
  }

  /**
   * Setup file watching for Claude Code conversations
   */
  async setupFileWatching() {
    try {
      const homeDir = os.homedir();
      const claudeDir = path.join(homeDir, '.claude');
      
      this.fileWatcher.setupFileWatchers(
        claudeDir,
        this.handleDataRefresh.bind(this),
        () => {}, // processRefreshCallback (not needed for mobile)

View on GitHub (pinned to a0851ed10c)