Skip to content

[BUG] Can't get the orchestrator to start - followed the guide #2

@jruokola

Description

@jruokola

Bug Report: Configuration file loading fails in start command

Summary

The gemini-flow start command fails to load configuration files from the current working directory, even when using the --config flag with the correct filename.

Environment

  • OS: macOS
  • Node.js version: 24.2
  • Gemini Code Flow version: Current
  • Installation method: npm global install

Steps to Reproduce

  1. Create a .gemini-flow.json configuration file in your project directory
  2. Navigate to that directory in terminal
  3. Run gemini-flow start or gemini-flow start --config .gemini-flow.json

Expected Behavior

The CLI should successfully load the configuration file from the current working directory and start the orchestrator.

Actual Behavior

The command fails with an error indicating it cannot find the configuration file, even when the file exists and has proper permissions (chmod 644).

Root Cause Analysis

The issue is in /dist/cli.js at line 79:

const config = require(options.config);

This code has two problems:

1. Incorrect Path Resolution

require() resolves paths relative to the CLI module location (/opt/homebrew/lib/node_modules/gemini-code-flow/dist/), not the user's current working directory. This means it's looking for the config file in the wrong location.

2. Incorrect File Loading Method

require() is designed for JavaScript modules, not JSON files in arbitrary locations. While Node.js can require() JSON files, this approach doesn't work reliably with relative paths from different working directories.

Proposed Solution

Replace the problematic line with proper file system operations:

// Add these imports at the top
const fs = require('fs');
const path = require('path');

// Replace the config loading line
const configPath = path.resolve(process.cwd(), options.config);
const configContent = fs.readFileSync(configPath, 'utf8');
const config = JSON.parse(configContent);

This solution:

  • Uses process.cwd() to resolve paths relative to the user's current directory
  • Uses fs.readFileSync() for explicit file reading
  • Uses JSON.parse() for proper JSON parsing
  • Provides better error handling opportunities

Additional Considerations

  • Add proper error handling for file not found scenarios
  • Consider adding validation for the JSON configuration structure
  • Add helpful error messages that guide users to create the config file if missing

Files Affected

  • /dist/cli.js (line ~79)
  • Potentially the TypeScript source file that generates this compiled JavaScript

Workaround

Currently, users must either:

  1. Place the config file in the CLI installation directory (not practical)
  2. Use absolute paths with the --config flag
  3. Modify the CLI code manually as described in the proposed solution

This bug significantly impacts usability as users expect to run the CLI from their project directories with local configuration files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions