can1357/oh-my-pi · error · Error
Trusted extension failed to load: ${extensionsResult.errors.
Error message
Trusted extension failed to load: ${extensionsResult.errors.map(item => item.error).join("; ")} What it means
When the CLI is started with explicit trusted extensions, any extension that fails to load is fatal. After extension discovery, if parsedArgs.trustedExtensions is non-empty and extensionsResult.errors has entries, main() throws an Error whose message joins each failure's error text with '; '. This is deliberate fail-fast behavior: the user explicitly asked for these extensions, so silently degrading is not acceptable.
Source
Thrown at packages/coding-agent/src/main.ts:1894
// `preloadedExtensions` so the discovery work is not repeated.
if (isInteractive && !parsedArgs.trustedExtensions?.length) {
sessionOptions.extensions = [...(sessionOptions.extensions ?? []), createWarpEventBridgeExtension()];
}
const eventBus = new EventBus();
const subagentEventBus = new EventBus();
const extensionsResult = parsedArgs.trustedExtensions?.length
? await loadTrustedSessionExtensions(sessionOptions, cwd, eventBus)
: await loadSessionExtensions(sessionOptions, cwd, settingsInstance, eventBus);
const extensionFlagSink: ExtensionFlagSink = {
getFlags: () => ExtensionRunner.aggregateFlags(extensionsResult.extensions),
setFlagValue: (name, value) => {
extensionsResult.runtime.flagValues.set(name, value);
},
};
const initialArgs = applyExtensionFlags(extensionFlagSink, rawArgs) ?? parsedArgs;
normalizeContinueSessionArgs(initialArgs, rawArgs);
if ((parsedArgs.trustedExtensions?.length ?? 0) > 0 && extensionsResult.errors.length > 0) {
throw new Error(
`Trusted extension failed to load: ${extensionsResult.errors.map(item => item.error).join("; ")}`,
);
}
for (const message of formatExtensionLoadNotifications(extensionsResult.errors)) {
if (isInteractive) {
notifs.push({ kind: "warn", message });
} else {
process.stderr.write(`${chalk.yellow(`${message}\n`)}`);
}
}
// Fail fast on stale/typo flags (e.g. `omp --list-models`) now that we
// know the real extension flag set. Without this check the unrecognized
// token gets silently consumed and any following positional leaks as the
// initial prompt — kicking off a real LLM session, MCP connection, and
// tool calls (issue #2459). Exit code 2 matches the conventional
// "command line usage error" convention.
if (reportUnrecognizedFlags(initialArgs)) {View on GitHub (pinned to 9690622007)
Solutions
- Fix the underlying extension error shown after the prefix — the joined messages name each failing extension.
- Verify each trusted extension path exists and points to a loadable module entrypoint.
- Remove the broken extension from the trustedExtensions list (or drop the flag) to start without it.
- Update or reinstall the extension to a version compatible with the current CLI.
Example fix
// before
const initialArgs = { ...rawArgs, trustedExtensions: ["./ext/old-entry.ts"] };
// after
const initialArgs = { ...rawArgs, trustedExtensions: ["./ext/entry.ts"] }; // path fixed / valid module Defensive patterns
Strategy: try-catch
Validate before calling
import * as fs from "node:fs";
function trustedExtensionPathsLookLoadable(args: string[]): string | null {
for (const p of args) {
if (!fs.existsSync(p)) return `trusted extension path not found: ${p}`;
}
return null;
} Type guard
function hasTrustedExtensionErrors(r: { errors: { error: unknown }[] }): boolean {
return r.errors.length > 0;
} Try / catch
try {
await startCli(rawArgs);
} catch (err) {
if (err instanceof Error && err.message.startsWith("Trusted extension failed to load:")) {
console.error(err.message);
console.error("Fix or remove the extension from --trusted-ext, or start without it.");
process.exitCode = 1;
return;
}
throw err;
} Prevention
- Pin trusted extension paths and verify they exist in CI before launch.
- Keep extensions updated to the CLI's plugin API version.
- Run the CLI once without the trusted-ext flag to isolate which extension fails.
- Lint/test extension modules as part of your repo.
When it happens
Trigger: Running the CLI with one or more trusted extensions listed while at least one of them throws during discovery/load (bad entry point, syntax error in the extension module, incompatible plugin API, unreadable path), so extensionsResult.errors.length > 0.
Common situations: Typo'd or stale extension path after a rename/move; extension written against an older plugin API that now throws on import; extension pointing at a directory without a valid entrypoint; permissions problem reading the extension file.
Related errors
- Trusted extension must be an existing module file: ${trusted
- Trusted extension must be a module file, not a directory: ${
- Trusted extension failed to load: ${trustedExtensions.errors
- --list-details, --exec, and --exec-batch are not supported b
- positional paths cannot be combined with --search-path
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/9ab72bb358c3f593.
Report an issue: GitHub.