diegosouzapw/OmniRoute · error · CodexAuthFileError

path_unavailable

path_unavailable

Error message

Codex auth path could not be resolved

What it means

Error "Codex auth path could not be resolved" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/oauth/utils/codexAuthFile.ts:314

  return {
    connectionId,
    connectionLabel,
    fileName,
    payload,
    content,
  };
}

export async function writeCodexAuthFileToLocalCli(connectionId: string) {
  const built = await buildCodexAuthFile(connectionId);
  const paths = getCliConfigPaths("codex");
  // authPath is sourced exclusively from the static CLI_TOOLS table in
  // src/shared/services/cliRuntime.ts (joined against os.homedir() inside
  // that helper). No external/user input ever reaches the path APIs below.
  const authPath = paths?.auth;

  if (!authPath) {
    throw new CodexAuthFileError("Codex auth path could not be resolved", 500, "path_unavailable");
  }

  const authDir = path.dirname(authPath);
  await fs.mkdir(authDir, { recursive: true });

  // Side-by-side .bak inside the .codex directory for one-click manual
  // rollback. Both halves are server-controlled (authDir from the static
  // CLI_TOOLS table; basename from a server-generated ISO timestamp), so
  // string concatenation here is safe — and avoids the false-positive
  // taint on path.join when Semgrep cannot follow the trust chain.
  let savedBakPath: string | null = null;
  try {
    await fs.access(authPath);
    const ts = new Date().toISOString().replace(/[:.]/g, "-");
    savedBakPath = `${authDir}${path.sep}auth-${ts}.bak`;
    await fs.copyFile(authPath, savedBakPath);
  } catch {
    // No existing file; nothing to back up side-by-side.

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/oauth/utils/codexAuthFile.ts:314 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/c292b4467d054f1e. Report an issue: GitHub.