ruvnet/ruflo · error · Error

statusline-generator: could not locate…

Error message

statusline-generator: could not locate .claude/helpers/statusline.cjs relative to @claude-flow/cli. This is a packaging bug — the helper must ship with the CLI (see package.json files entry for .claude).

What it means

The statusline generator walks up the directory tree from the CLI package root looking for .claude/helpers/statusline.cjs; if the file is never found it throws, because the helper is required to ship inside the published @claude-flow/cli package (its package.json `files` entry must include .claude). The error explicitly labels itself a packaging bug — it means the installed artifact is missing an asset, not that user input was wrong.

Solutions

  1. Verify the file exists: ls node_modules/@claude-flow/cli/.claude/helpers/statusline.cjs — if missing, reinstall cleanly (`npm cache clean --force && rm -rf node_modules package-lock.json && npm install`)
  2. Pin to a known-good published version: `npm install @claude-flow/cli@latest` rather than a fork or local tarball
  3. If you build/publish the package yourself, ensure package.json `files` includes ".claude" and that the helper is present in the tarball (`npm pack` then `tar -tzf *.tgz | grep statusline`)
  4. If a published release is genuinely missing the asset, report it upstream with your install method — the message says 'see package.json files entry for .claude'

Example fix

// before — publishing pipeline drops dot-directories
// package.json
"files": ["dist", "src", "README.md"]

// after — helper ships with the CLI
"files": ["dist", "src", "README.md", ".claude"]
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: confirm the helper asset shipped with the install
import { existsSync } from 'node:fs';
import { join } from 'node:path';

const helper = join(
  require.resolve('@claude-flow/cli').replace(/\/[^/]*$/, ''),
  '.claude/helpers/statusline.cjs'
);
if (!existsSync(helper)) console.warn('statusline helper missing — install is incomplete');

Try / catch

try {
  const out = generateStatusline(cfg);
  fs.writeFileSync(statusPath, out);
} catch (err) {
  // Packaging bug — degrade gracefully: skip the statusline rather than abort init
  console.warn(`statusline skipped: ${(err as Error).message}`);
}

Prevention

When it happens

Trigger: Installing from a tarball or fork whose package.json `files` array (or .npmignore) excluded the dot-directory `.claude`; a bundler (esbuild/webpack/vercel ncc) that stripped non-code assets when repacking; a corrupted or partial npm install where node_modules/@claude-flow/cli/.claude was deleted; running from a source checkout that never copied the helper into dist.

Common situations: Companies vendoring the CLI through an internal registry that repacks with different files rules; pnpm strict symlink layouts combined with custom deploy scripts; npm cache corruption after an interrupted install; forks that renamed .claude and forgot this lookup; Docker images built with `npm prune --production` plus an aggressive asset-stripping layer.

Related errors


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/ab4ecdf76218bb84. Report an issue: GitHub.

Appendix: source

Thrown at v3/@claude-flow/cli/src/init/statusline-generator.ts:133

    for (let i = 0; i < 6; i++) {
      try {
        const pkg = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));
        if (pkg && pkg.name === '@claude-flow/cli') {
          const candidate = path.join(dir, '.claude', 'helpers', 'statusline.cjs');
          if (fs.existsSync(candidate)) {
            helperPackageRoot = dir;
            helperContent = fs.readFileSync(candidate, 'utf-8');
            break;
          }
        }
      } catch { /* keep climbing */ }
      const parent = path.dirname(dir);
      if (parent === dir) break;
      dir = parent;
    }
  }
  if (helperContent === null) {
    throw new Error(
      'statusline-generator: could not locate .claude/helpers/statusline.cjs '
      + 'relative to @claude-flow/cli. This is a packaging bug — the helper '
      + 'must ship with the CLI (see package.json files entry for .claude).'
    );
  }

  // Two known interpolation points — both single-line, both idempotent
  // string replacements. If a future edit to the helper renames either
  // token, this replace() is a no-op and the fallback default (15,
  // whatever the helper hard-codes) ships. Add a paired test in
  // statusline-cost-display.test.ts before changing either token.
  helperContent = helperContent.replace(/maxAgents: \d+,/, `maxAgents: ${maxAgents},`);
  helperContent = helperContent.replace(
    /const BAKED_INSTALL_ROOT = "[^"]*";/,
    `const BAKED_INSTALL_ROOT = ${JSON.stringify(helperPackageRoot)};`,
  );
  // Only overwrite the helper's baked version if OURS resolves higher.
  // Otherwise the substitution could DOWNGRADE (test environments where

View on GitHub (pinned to fa13ee4ad6)