Fission-AI/OpenSpec · error

Parent path is not a directory

Error message

Parent path is not a directory: ${candidate}

What it means

Filesystem-shape guard in assertCreatableFilePath: while walking up from a Copilot file to find a creatable parent, an ancestor path exists but is not a directory (it is a file or symlink to a file). The offending ancestor is named in the message.

Solutions

  1. Find the named path and remove or relocate the file blocking the directory chain
  2. Ensure the Copilot instructions directory path does not collide with an existing file
  3. Retry the Copilot setup step
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/github-copilot/cloud-agent.ts:359 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/08b713dfe92fae9f. Report an issue: GitHub.

Appendix: source

Thrown at src/core/github-copilot/cloud-agent.ts:359

  if (isCurrentCopilotCloudFile(relPath, existingContent)) {
    return false;
  }
  if (!isLegacyCopilotCloudFile(relPath, existingContent)) {
    return false;
  }

  await FileSystemUtils.writeFile(fullPath, currentContent);
  return true;
}

async function assertCreatableFilePath(filePath: string): Promise<void> {
  let candidate = path.dirname(filePath);

  while (true) {
    try {
      const stats = await fs.stat(candidate);
      if (!stats.isDirectory()) {
        throw new Error(`Parent path is not a directory: ${candidate}`);
      }
      return;
    } catch (error) {
      if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
        throw error;
      }
    }

    const parent = path.dirname(candidate);
    if (parent === candidate) {
      throw new Error(`Cannot resolve a directory ancestor for: ${filePath}`);
    }
    candidate = parent;
  }
}

async function assertMissingOrRegularFile(filePath: string): Promise<void> {
  try {

View on GitHub (pinned to 6926ccb18a)