Fission-AI/OpenSpec · error · Error

Path "${targetPath}" is not a directory

Error message

Path "${targetPath}" is not a directory

What it means

Error "Path "${targetPath}" is not a directory" thrown in Fission-AI/OpenSpec.

Source

Thrown at src/cli/index.ts:237

program
  .command('init [path]')
  .description('Initialize OpenSpec in your project')
  .option('--tools <tools>', toolsOptionDescription)
  .option('--language <language>', 'Write new OpenSpec artifacts in this language')
  .option('--force', 'Auto-cleanup legacy files without prompting')
  .option('--profile <profile>', 'Override global config profile (core or custom)')
  .option('--no-animation', 'Show a static welcome screen instead of the animated one')
  .option('--copilot-cloud', 'Set up GitHub Copilot cloud coding-agent files without prompting')
  .option('--no-copilot-cloud', 'Skip GitHub Copilot cloud coding-agent files without prompting')
  .action(async (targetPath = '.', options?: { tools?: string; language?: string; force?: boolean; profile?: string; animation?: boolean; copilotCloud?: boolean }) => {
    try {
      // Validate that the path is a valid directory
      const resolvedPath = path.resolve(targetPath);

      try {
        const stats = await fs.stat(resolvedPath);
        if (!stats.isDirectory()) {
          throw new Error(`Path "${targetPath}" is not a directory`);
        }
      } catch (error: any) {
        if (error.code === 'ENOENT') {
          // Directory doesn't exist, but we can create it
          console.log(`Directory "${targetPath}" doesn't exist, it will be created.`);
        } else if (error.message && error.message.includes('not a directory')) {
          throw error;
        } else {
          throw new Error(`Cannot access path "${targetPath}": ${error.message}`);
        }
      }

      const { InitCommand } = await import('../core/init.js');
      const initCommand = new InitCommand({
        tools: options?.tools,
        language: options?.language,
        force: options?.force,
        profile: options?.profile,

View on GitHub (pinned to 6926ccb18a)

When it happens

Trigger: Thrown at src/cli/index.ts:237 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/28aef15002b1297c. Report an issue: GitHub.