earendil-works/pi · error

Invalid trust store : value for must be true, false, or null

Error message

Invalid trust store ${path}: value for ${JSON.stringify(key)} must be true, false, or null

What it means

Value validation in readTrustFile: within the trust-store object, the entry for the named key is not one of the allowed literals true, false, or null. Any other JSON value (string, number, nested object) is rejected for that project-path key.

Solutions

  1. Set each trust entry to true (trusted), false (distrusted), or null (ask again)
  2. Remove invalid entries so defaults apply
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/trust-manager.ts:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/0790cfea9129960f. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/trust-manager.ts:118

		return {};
	}

	let parsed: unknown;
	try {
		parsed = JSON.parse(stripBom(readFileSync(path, "utf-8")));
	} catch (error) {
		const message = error instanceof Error ? error.message : String(error);
		throw new Error(`Failed to read trust store ${path}: ${message}`);
	}

	if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
		throw new Error(`Invalid trust store ${path}: expected an object`);
	}

	const data: TrustFile = {};
	for (const [key, value] of Object.entries(parsed)) {
		if (value !== true && value !== false && value !== null) {
			throw new Error(`Invalid trust store ${path}: value for ${JSON.stringify(key)} must be true, false, or null`);
		}
		data[key] = value;
	}
	return data;
}

function writeTrustFile(path: string, data: TrustFile): void {
	const sorted: TrustFile = {};
	for (const key of Object.keys(data).sort()) {
		const value = data[key];
		if (value === true || value === false || value === null) {
			sorted[key] = value;
		}
	}
	mkdirSync(dirname(path), { recursive: true });
	writeFileSync(path, `${JSON.stringify(sorted, null, 2)}\n`, "utf-8");
}

View on GitHub (pinned to 4af9d21d3b)