{"record":{"id":"28aef15002b1297c","repo":"Fission-AI/OpenSpec","slug":"path-targetpath-is-not-a-directory","errorCode":null,"errorMessage":"Path \"${targetPath}\" is not a directory","messagePattern":"Path \"(.+?)\" is not a directory","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":237,"sourceCode":"program\n  .command('init [path]')\n  .description('Initialize OpenSpec in your project')\n  .option('--tools <tools>', toolsOptionDescription)\n  .option('--language <language>', 'Write new OpenSpec artifacts in this language')\n  .option('--force', 'Auto-cleanup legacy files without prompting')\n  .option('--profile <profile>', 'Override global config profile (core or custom)')\n  .option('--no-animation', 'Show a static welcome screen instead of the animated one')\n  .option('--copilot-cloud', 'Set up GitHub Copilot cloud coding-agent files without prompting')\n  .option('--no-copilot-cloud', 'Skip GitHub Copilot cloud coding-agent files without prompting')\n  .action(async (targetPath = '.', options?: { tools?: string; language?: string; force?: boolean; profile?: string; animation?: boolean; copilotCloud?: boolean }) => {\n    try {\n      // Validate that the path is a valid directory\n      const resolvedPath = path.resolve(targetPath);\n\n      try {\n        const stats = await fs.stat(resolvedPath);\n        if (!stats.isDirectory()) {\n          throw new Error(`Path \"${targetPath}\" is not a directory`);\n        }\n      } catch (error: any) {\n        if (error.code === 'ENOENT') {\n          // Directory doesn't exist, but we can create it\n          console.log(`Directory \"${targetPath}\" doesn't exist, it will be created.`);\n        } else if (error.message && error.message.includes('not a directory')) {\n          throw error;\n        } else {\n          throw new Error(`Cannot access path \"${targetPath}\": ${error.message}`);\n        }\n      }\n\n      const { InitCommand } = await import('../core/init.js');\n      const initCommand = new InitCommand({\n        tools: options?.tools,\n        language: options?.language,\n        force: options?.force,\n        profile: options?.profile,","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/cli/index.ts#L219-L255","documentation":"Error \"Path \"${targetPath}\" is not a directory\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/cli/index.ts:237 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}