Fission-AI/OpenSpec · error · StoreError

store_git_commit_failed

store_git_commit_failed

Error message

Failed to create the initial store commit: ${error instanceof Error ? error.message : String(error)}

What it means

StoreError wrapping a failed 'git add'/'git commit' pair in commitStoreFiles during store setup. Common causes surfaced by the embedded message include gpg signing failures and rejecting hooks; a best-effort 'git rm --cached' unstage runs afterward so rollback stays clean.

Solutions

  1. Address the embedded git error (commit signing, hook rejection, index lock)
  2. Temporarily disable signing or fix the failing hook, then rerun setup
  3. Remove stale .git/index.lock if a previous git process crashed
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/store/git.ts:117 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/c9782a59f0bc5ef0. Report an issue: GitHub.

Appendix: source

Thrown at src/core/store/git.ts:117

  if (pathspecs.length === 0) {
    return false;
  }

  try {
    await execFileAsync('git', ['add', '--', ...pathspecs], { cwd: storeRoot });
    await execFileAsync(
      'git',
      ['commit', '-m', `Initialize OpenSpec store ${id}`, '--', ...pathspecs],
      { cwd: storeRoot }
    );
  } catch (error) {
    // Best-effort unstage so a failed commit (gpg signing, hooks) does not
    // leave setup's files in the user's index after rollback deletes them.
    await execFileAsync('git', ['rm', '--cached', '-r', '-f', '-q', '--', ...pathspecs], {
      cwd: storeRoot,
    }).catch(() => undefined);

    throw new StoreError(
      `Failed to create the initial store commit: ${error instanceof Error ? error.message : String(error)}`,
      'store_git_commit_failed',
      {
        target: 'store.git',
        fix: 'Commit the created files manually, or rerun setup with --no-init-git.',
      }
    );
  }

  return true;
}

async function gitProbe(storeRoot: string, args: string[]): Promise<string | null> {
  try {
    const { stdout } = await execFileAsync('git', ['-C', storeRoot, ...args]);
    return stdout;
  } catch {
    return null;

View on GitHub (pinned to 6926ccb18a)