can1357/oh-my-pi · error · Error

Unsupported security store index at ${this.#indexPath()}

Error message

Unsupported security store index at ${this.#indexPath()}

What it means

SecurityStore.#readIndex validates the persisted index.json against the expected schemaVersion and the store's projectKey. A mismatch means the on-disk index was written by a different schema version or belongs to a different project, so the store refuses to interpret it rather than serving wrong data.

Source

Thrown at packages/coding-agent/src/security/store.ts:222

		try {
			await this.#readIndex();
		} catch (error) {
			if (!isEnoent(error)) throw error;
			await this.#writeIndex({
				schemaVersion: STORE_SCHEMA_VERSION,
				projectKey: this.#projectKey,
				repositoryRoot: this.#repositoryRoot,
				scanIds: [],
				planIds: [],
				updatedAt: new Date().toISOString(),
			});
		}
	}

	async #readIndex(): Promise<SecurityStoreIndex> {
		const value = (await readJsonFile(this.#indexPath())) as Partial<SecurityStoreIndex>;
		if (value.schemaVersion !== STORE_SCHEMA_VERSION || value.projectKey !== this.#projectKey) {
			throw new Error(`Unsupported security store index at ${this.#indexPath()}`);
		}
		if (!Array.isArray(value.scanIds) || !value.scanIds.every(id => typeof id === "string")) {
			throw new Error(`Invalid security store scan index at ${this.#indexPath()}`);
		}
		if (
			value.planIds !== undefined &&
			(!Array.isArray(value.planIds) || !value.planIds.every(id => typeof id === "string"))
		) {
			throw new Error(`Invalid security store plan index at ${this.#indexPath()}`);
		}
		return { ...value, planIds: value.planIds ?? [] } as SecurityStoreIndex;
	}

	async #writeIndex(index: SecurityStoreIndex): Promise<void> {
		await writeSecurityFileAtomic(this.#indexPath(), `${JSON.stringify(index, null, 2)}\n`);
	}

	async #putBundleUnlocked(input: SecurityScanBundle): Promise<void> {

View on GitHub (pinned to 9690622007)

Solutions

  1. Delete the stale scans/index.json (and scans/plans directories) so the store reinitializes a fresh index
  2. Re-run the scans/plans under the current tool version to regenerate the store
  3. Restore the matching project layout/key, or open the store from the original project path
  4. Check the STORE_SCHEMA_VERSION expectations of your installed version before migrating data

Example fix

// before
// index.json: { schemaVersion: 1, projectKey: "old-key", ... }
// after
rm -rf <project>/.omp/security/scans/index.json  # let the store recreate it with current schema
Defensive patterns

Strategy: try-catch

Validate before calling

const idx = await Bun.file(indexPath).json();
if (idx.schemaVersion !== STORE_SCHEMA_VERSION || idx.projectKey !== key) console.warn("incompatible index");

Type guard

null

Try / catch

try { openStore(dir); } catch (e) { if (String(e.message).startsWith("Unsupported security store index")) { await fs.rm(indexPath); } else throw e; }

Prevention

When it happens

Trigger: Opening a SecurityStore where scans/index.json has a schemaVersion different from STORE_SCHEMA_VERSION, or a projectKey that does not match the current project directory/key (e.g. the project moved or the index was copied between projects).

Common situations: Upgrading or downgrading the tool between store schema versions, manually copying .omp/security data between repos, editing index.json by hand, or a partially-written/corrupt index.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/35b7a05d50533f22. Report an issue: GitHub.