can1357/oh-my-pi · error · CliUsageError
--trusted-extension requires an absolute path: ${trustedPath
Error message
--trusted-extension requires an absolute path: ${trustedPath} What it means
Trusted extensions are only accepted as absolute paths; parseArgs runs path.isAbsolute on each --trusted-extension value and throws this CliUsageError for relative paths like ./ext or ext.
Source
Thrown at packages/coding-agent/src/cli/args.ts:328
args.splice(equalsValueIndex, 1);
}
}
const swallowedTrustedFlag = [...(result.extensions ?? []), ...(result.hooks ?? [])].some(
value => value === "--trusted-extension" || value.startsWith("--trusted-extension="),
);
if ((result.trustedExtensions?.length ?? 0) !== trustedFlagCount || swallowedTrustedFlag) {
throw new CliUsageError("--trusted-extension requires a non-empty, non-flag value");
}
if (trustedFlagCount > 0 && ((result.extensions?.length ?? 0) > 0 || (result.hooks?.length ?? 0) > 0)) {
throw new CliUsageError("--trusted-extension cannot be combined with --extension, -e, or --hook");
}
for (const trustedPath of result.trustedExtensions ?? []) {
if (trustedPath.length === 0) {
throw new CliUsageError("--trusted-extension requires a non-empty, non-flag value");
}
if (!path.isAbsolute(trustedPath)) {
throw new CliUsageError(`--trusted-extension requires an absolute path: ${trustedPath}`);
}
}
return result;
}
/** Reject requested tool names absent from the fully discovered session registry. */
export function validateToolNames(requested: readonly string[] | undefined, known: readonly string[]): void {
if (!requested) return;
const knownNames = new Set(known);
const unknown = requested.filter(name => !knownNames.has(name));
if (unknown.length === 0) return;
throw new CliUsageError(
`Unknown tool${unknown.length === 1 ? "" : "s"} in --tools: ${unknown.join(", ")}. Valid tools: ${known.join(", ")}.`,
);
}
/**View on GitHub (pinned to 9690622007)
Solutions
- Prefix the path to make it absolute, e.g. --trusted-extension="$PWD/my-ext" or --trusted-extension=/home/me/proj/my-ext.
- In scripts, resolve with an absolute form before invoking.
- Windows users: include the drive letter (C:\path\to\ext).
Example fix
// before omp --trusted-extension ./extensions/toolkit // after omp --trusted-extension="$PWD/extensions/toolkit"
Defensive patterns
Strategy: validation
Validate before calling
const trusted = ["extensions/toolkit"];
for (const p of trusted) {
if (!path.isAbsolute(p)) throw new Error(`--trusted-extension requires an absolute path: ${p}`);
} Type guard
function isAbsolutePath(p: string): boolean {
return path.isAbsolute(p);
} Try / catch
try {
const parsed = parseArgs(argv);
} catch (err) {
if (err instanceof CliUsageError && err.message.includes("absolute path")) {
console.error("Resolve the path: --trusted-extension=$PWD/<path>");
process.exitCode = 2;
return;
}
throw err;
} Prevention
- Always pass $PWD-prefixed or resolved absolute paths to --trusted-extension.
- Remember cwd changes between shells/CI steps; relative paths break silently.
- On Windows include the drive letter.
When it happens
Trigger: Running `omp --trusted-extension ./my-ext` or `--trusted-extension my-ext` — any value that does not start with the filesystem root (or a drive root on Windows).
Common situations: Copy-pasting a relative path from project docs, or running the same command from a different cwd than the one the path was written for.
Related errors
- --trusted-extension requires a non-empty, non-flag value
- too many templates
- invalid {} argument: {}
- invalid Zero increment value: {}
- extra operand {} file operands cannot be combined with --fil
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/672f56fde619039a.
Report an issue: GitHub.