Fission-AI/OpenSpec · error · Error

--language does not overwrite an existing OpenSpec config…

Error message

--language does not overwrite an existing OpenSpec config. Add the language instruction to its context field instead.

What it means

Safety guard for --language: an existing OpenSpec config (config.yaml/config.yml) already defines the project context, and init refuses to overwrite it — language instructions must be merged manually.

Solutions

  1. Edit the existing config's context field and append the language instruction
  2. Remove or rename the existing config if replacement is truly intended
  3. Re-run init without --language to keep the existing config untouched
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at src/core/init.ts:1081

    if (!hasConfig) {
      try {
        FileSystemUtils.assertProjectArtifactPath(projectPath, configPath);
      } catch (error) {
        const reason = error instanceof Error ? `: ${error.message}` : '';
        throw new Error(`Cannot create openspec/config.yaml for --language${reason}`);
      }
      if (!(await FileSystemUtils.canWriteFile(configPath))) {
        throw new Error(
          'Cannot create openspec/config.yaml for --language: the destination is not writable.'
        );
      }
      return;
    }

    const existingContext = readProjectConfig(projectPath)?.context;
    if (existingContext?.includes(languageContext)) return;

    throw new Error(
      '--language does not overwrite an existing OpenSpec config. ' +
      'Add the language instruction to its context field instead.'
    );
  }

  private async createConfig(openspecPath: string, extendMode: boolean): Promise<'created' | 'exists' | 'skipped'> {
    const configPath = path.join(openspecPath, 'config.yaml');
    const configYmlPath = path.join(openspecPath, 'config.yml');
    const configYamlExists = fs.existsSync(configPath);
    const configYmlExists = fs.existsSync(configYmlPath);

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


    try {
      const yamlContent = serializeConfig({

View on GitHub (pinned to 6926ccb18a)