can1357/oh-my-pi · error
Trusted extension failed to load: ${trustedExtensions.errors
Error message
Trusted extension failed to load: ${trustedExtensions.errors.map(item => item.error).join("; ")} What it means
In the ACP session factory, after trusted extensions are loaded, any per-extension load error collected by loadTrustedSessionExtensions is aggregated and thrown as a single fatal error, joining all individual error messages with '; '. The ACP path treats trusted extensions as required, so partial load failure aborts session creation.
Source
Thrown at packages/coding-agent/src/main.ts:432
export function createAcpSessionFactory(args: AcpSessionFactoryOptions): AcpSessionFactory {
return async (cwd, factoryOptions) => {
const nextSettings = await args.settings.cloneForCwd(cwd);
const nextSessionManager = SessionManager.create(cwd, args.sessionDir);
const agentId = `acp:${nextSessionManager.getSessionId()}`;
// `baseOptions.titleSystemPrompt` is resolved from the launch cwd; an ACP
// host can open `session/new` for any client-supplied workspace, so
// re-discover `TITLE_SYSTEM.md` against THIS session's `cwd` to keep the
// replan-driven title refresh consistent with the target project's
// policy (PR #3736 follow-up).
const titleSystemPromptSource = discoverTitleSystemPromptFile(cwd);
const titleSystemPrompt = await resolvePromptInput(titleSystemPromptSource, "title system prompt");
const eventBus = new EventBus();
const trustedExtensions =
args.parsedArgs.trustedExtensions && args.parsedArgs.trustedExtensions.length > 0
? await loadTrustedSessionExtensions(args.baseOptions, cwd, eventBus)
: undefined;
if (trustedExtensions && trustedExtensions.errors.length > 0) {
throw new Error(
`Trusted extension failed to load: ${trustedExtensions.errors.map(item => item.error).join("; ")}`,
);
}
const { session: nextSession, setToolUIContext } = await args.createSession({
...args.baseOptions,
cwd,
sessionManager: nextSessionManager,
settings: nextSettings,
authStorage: args.authStorage,
modelRegistry: args.modelRegistry,
agentId,
// ACP defers the `ask` capability and reserve-policy confirmation until
// client capabilities are known, without enabling other UI-only behavior.
interactivePrompts: factoryOptions?.interactivePrompts,
deferUsageReserveConfirmation: true,
enableMCP: false,
titleSystemPrompt,
eventBus,View on GitHub (pinned to 9690622007)
Solutions
- Read the joined messages to find each failing extension and its root cause.
- Fix or remove the failing extension path from --trusted-extension arguments.
- Run the extension module directly (bun run path/to/ext.ts) to reproduce its load error in isolation.
- Reinstall missing dependencies the extension imports.
Example fix
// before omp --trusted-extension ./broken-ext.ts // error: Trusted extension failed to load: Cannot find module 'missing-dep' // after bun add missing-dep # or fix/remove the extension path omp --trusted-extension ./broken-ext.ts
Defensive patterns
Strategy: try-catch
Validate before calling
for (const p of trustedExtensionPaths) {
try { await import(p); } catch (e) { console.error(`Extension ${p} fails to load: ${e.message}`); }
} Try / catch
try {
await startAcpSession(args);
} catch (err) {
if (err.message.startsWith("Trusted extension failed to load:")) {
for (const msg of err.message.slice("Trusted extension failed to load: ".length).split("; ")) console.error(msg);
}
throw err;
} Prevention
- Pre-flight import each trusted extension in isolation before wiring it into omp.
- Keep extension dependencies installed in the extension's own node_modules.
- Remove stale extension paths from launch scripts after renaming files.
When it happens
Trigger: createAcpSessionFactory invoked with args.parsedArgs.trustedExtensions non-empty, and loadTrustedSessionExtensions returns { errors: [...] } (syntax error in an extension module, missing dependency, top-level throw, import of a nonexistent file).
Common situations: Extension module has a TypeScript/import error or references an uninstalled dependency; extension file was moved/renamed after being configured; extension throws during initialization; Node/Bun version incompatibility in extension code.
Related errors
- Trusted extension must be a module file, not a directory: ${
- Trusted extension failed to load: ${extensionsResult.errors.
- --list-details, --exec, and --exec-batch are not supported b
- positional paths cannot be combined with --search-path
- unknown file type: {value}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e6159f148c8bb397.
Report an issue: GitHub.