Fission-AI/OpenSpec · error · StoreError

invalid_store_metadata

invalid_store_metadata

Error message

${error instanceof Error ? error.message : String(error)}

What it means

Wrapping boundary in readStoreMetadataForOperation: reading the store's metadata state threw (parse or IO failure other than missing-file, which maps to 'missing' earlier), and the raw message is re-thrown as a StoreError with code 'invalid_store_metadata'. The store's identity file is present but unreadable or malformed.

Solutions

  1. Inspect and repair the store metadata file at the store's metadata path (JSON syntax, schema)
  2. Restore the metadata file from version control or a backup
  3. Re-register the store if the metadata cannot be salvaged
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/store/operations.ts:200 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/e9cc737dbdb1ac9b. Report an issue: GitHub.

Appendix: source

Thrown at src/core/store/operations.ts:200

      error !== null &&
      'code' in error &&
      (error as NodeJS.ErrnoException).code === 'ENOENT'
    ) {
      return 'missing';
    }
    throw error;
  }
}

async function isDirectoryEmpty(directory: string): Promise<boolean> {
  return (await fs.readdir(directory)).length === 0;
}

async function readStoreMetadataForOperation(storeRoot: string) {
  try {
    return await readOptionalStoreMetadataState(storeRoot);
  } catch (error) {
    throw new StoreError(
      error instanceof Error ? error.message : String(error),
      'invalid_store_metadata',
      {
        target: 'store.metadata',
        fix: `Repair ${getStoreMetadataPath(storeRoot)}.`,
      }
    );
  }
}

async function isGitOnlyDirectory(storeRoot: string): Promise<boolean> {
  const entries = await fs.readdir(storeRoot);
  return entries.length === 1 && entries[0] === '.git' && await isGitRepositoryAtRoot(storeRoot);
}

function alreadyRegisteredDiagnostic(id: string): StoreDiagnostic {
  return makeStoreDiagnostic(
    'info',

View on GitHub (pinned to 6926ccb18a)