Fission-AI/OpenSpec · error · Error

Failed to create openspec/config.yaml for --language

Error message

Failed to create openspec/config.yaml for --language${reason}

What it means

Thrown when writing openspec/config.yaml for --language fails: serializeConfig or FileSystemUtils.writeFile raised, and the underlying error message is appended as `reason`. Means the config file creation (schema + language context) could not be completed — filesystem error, permission, or invalid path — so the language setting was not persisted.

Solutions

  1. Read the appended reason to identify the exact write or path failure
  2. Verify the openspec directory exists and is writable
  3. Retry init with --language after fixing the underlying issue
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/init.ts:1109 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/6c22568c7d5f6c5e. Report an issue: GitHub.

Appendix: source

Thrown at src/core/init.ts:1109

    const configYmlExists = fs.existsSync(configYmlPath);

    if (configYamlExists || configYmlExists) {
      return 'exists';
    }


    try {
      const yamlContent = serializeConfig({
        schema: DEFAULT_SCHEMA,
        context: this.languageContext(),
      });
      FileSystemUtils.assertProjectArtifactPath(path.dirname(openspecPath), configPath);
      await FileSystemUtils.writeFile(configPath, yamlContent);
      return 'created';
    } catch (error) {
      if (this.language) {
        const reason = error instanceof Error ? `: ${error.message}` : '';
        throw new Error(`Failed to create openspec/config.yaml for --language${reason}`);
      }
      return 'skipped';
    }
  }

  // ═══════════════════════════════════════════════════════════
  // UI & OUTPUT
  // ═══════════════════════════════════════════════════════════

  private displaySuccessMessage(
    projectPath: string,
    tools: ValidatedInitTool[],
    results: {
      createdTools: typeof tools;
      refreshedTools: typeof tools;
      failedTools: Array<{ name: string; error: Error }>;
      commandsSkipped: string[];
      skillsInvocableCommandSkips: string[];

View on GitHub (pinned to 6926ccb18a)