Fission-AI/OpenSpec · error

Insufficient permissions to write to

Error message

Insufficient permissions to write to ${projectPath}

What it means

Thrown by the init command's validate step when FileSystemUtils.ensureWritePermissions reports the project path is not writable. OpenSpec must create its openspec/ directory structure (or extend an existing one) inside the project, so initialization aborts until the user grants write access to projectPath.

Solutions

  1. Check ownership and write permissions on the project directory
  2. Run init from a directory you can write to, or fix permissions first
  3. Retry openspec init after restoring write access
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/init.ts:357 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/50da1358932b2349. Report an issue: GitHub.

Appendix: source

Thrown at src/core/init.ts:357

      throw new Error(
        `OpenSpec setup failed for: ${results.failedTools.map((tool) => tool.name).join(', ')}`
      );
    }
  }

  // ═══════════════════════════════════════════════════════════
  // VALIDATION & SETUP
  // ═══════════════════════════════════════════════════════════

  private async validate(
    projectPath: string,
    openspecPath: string
  ): Promise<boolean> {
    const extendMode = await FileSystemUtils.directoryExists(openspecPath);

    // Check write permissions
    if (!(await FileSystemUtils.ensureWritePermissions(projectPath))) {
      throw new Error(`Insufficient permissions to write to ${projectPath}`);
    }
    return extendMode;
  }

  private canPromptInteractively(): boolean {
    if (this.interactiveOption === false) return false;
    if (this.toolsArg !== undefined) return false;
    return isInteractive({ interactive: this.interactiveOption });
  }

  /**
   * Decide whether to generate GitHub Copilot cloud files, and whether to
   * persist that decision. Precedence:
   *   1. `--copilot-cloud` / `--no-copilot-cloud` flag (explicit this run)
   *   2. persisted opt-in in config.yaml
   *   3. managed files already present (migration for pre-opt-in projects)
   *   4. interactive confirm (default No)
   *   5. non-interactive with no signal: skip, and don't persist a default

View on GitHub (pinned to 6926ccb18a)