earendil-works/pi · error · Error

Extension " " failed to load and its API is no longer…

Error message

Extension "${extension.path}" failed to load and its API is no longer active.

What it means

Staleness message set when an extension's module failed to load (threw during import/init): its API is permanently inactive, and any later use of its registration methods or captured API rethrows this error naming the extension path.

Solutions

  1. Fix the load error shown in extension diagnostics for the named path
  2. Disable or uninstall the broken extension
  3. Reload extensions after fixing the underlying module
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/extensions/loader.ts:266 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/f339bfe7d31d5123. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/extensions/loader.ts:266

/**
 * Create the ExtensionAPI for an extension.
 * Registration methods write to the extension object.
 * Action methods delegate to the shared runtime.
 */
function createExtensionAPI(
	extension: Extension,
	runtime: ExtensionRuntime,
	cwd: string,
	eventBus: EventBus,
): { api: ExtensionAPI; commit: () => void; discard: () => void } {
	const pendingFlagValues = new Map<string, boolean | string>();
	const pendingRuntimeChanges: Array<() => void> = [];
	const loadingUnsubscribers: Array<() => void> = [];
	let state: "loading" | "active" | "failed" = "loading";
	const assertActive = () => {
		if (state === "failed") {
			throw new Error(`Extension "${extension.path}" failed to load and its API is no longer active.`);
		}
		runtime.assertActive();
	};
	const applyRuntimeChange = (change: () => void) => {
		if (state === "loading") pendingRuntimeChanges.push(change);
		else change();
	};
	const clearPending = () => {
		pendingFlagValues.clear();
		pendingRuntimeChanges.length = 0;
		loadingUnsubscribers.length = 0;
	};

	const api = {
		// Registration methods - write to extension
		on(event: string, handler: HandlerFn): void {
			assertActive();
			const list = extension.handlers.get(event) ?? [];

View on GitHub (pinned to 4af9d21d3b)