coleam00/Archon · info

Codex will attempt to use those credentials. If they are

Error message

    Codex will attempt to use those credentials. If they are stale or revoked,

What it means

Continuation line of the stale persisted Codex auth warning: after noting CODEX_* env vars are unset but auth.json exists, setupAuth tells the operator that Codex will attempt to use those stored credentials and that they may be stale or revoked. Informational multi-line console.warn output, not a failure by itself.

Source

Thrown at packages/server/src/scripts/setup-auth.ts:41

function setupAuth(): void {
  // Get environment variables
  const idToken = process.env.CODEX_ID_TOKEN;
  const accessToken = process.env.CODEX_ACCESS_TOKEN;
  const refreshToken = process.env.CODEX_REFRESH_TOKEN;
  const accountId = process.env.CODEX_ACCOUNT_ID;

  // No CODEX_* env vars provided: warn if a persisted auth.json already
  // exists on the volume (may be stale), otherwise skip with "unavailable".
  if (!idToken || !accessToken || !refreshToken || !accountId) {
    // /home/appuser is now persisted across restarts in Docker, so a stale
    // auth.json from a previous run with creds is not automatically wiped.
    // Surface this so operators don't end up with Codex silently using old/revoked tokens.
    const persistedAuthPath = path.join(os.homedir(), '.codex', 'auth.json');
    if (fs.existsSync(persistedAuthPath)) {
      console.warn(
        `⚠️  CODEX_* env vars not set, but persisted ${persistedAuthPath} exists from a previous run`
      );
      console.warn(
        '    Codex will attempt to use those credentials. If they are stale or revoked,'
      );
      console.warn(
        '    delete the file inside the container or wipe the archon_user_home volume to reset.'
      );
      return;
    }
    console.log('⏭️  Skipping Codex auth setup - credentials not provided');
    console.log('   Codex assistant will be unavailable');
    return;
  }

  console.log('🔐 Setting up Codex authentication...');

  // Create auth.json structure
  const authData: AuthJson = {
    OPENAI_API_KEY: null,
    tokens: {

View on GitHub (pinned to 0773b97458)

Solutions

  1. Delete ~/.codex/auth.json inside the container or wipe the archon_user_home volume
  2. Restore the CODEX_* env vars and re-run setup-auth to write fresh credentials
  3. Confirm Codex auth works after cleanup before relying on Codex nodes

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

const persisted = path.join(os.homedir(), '.codex', 'auth.json');
if (!hasFreshCodexEnv() && fs.existsSync(persisted)) {
  // stale credentials will be used — delete or re-provision first
}

Type guard

function isStaleCodexAuth(env: NodeJS.ProcessEnv, homedir: string): boolean {
  return !(env.CODEX_ID_TOKEN && env.CODEX_ACCESS_TOKEN && env.CODEX_REFRESH_TOKEN && env.CODEX_ACCOUNT_ID)
    && fs.existsSync(path.join(homedir, '.codex', 'auth.json'));
}

Try / catch

null

Prevention

When it happens

Trigger: Same path as error 612: setupAuth runs without CODEX_* env vars while ~/.codex/auth.json persists from a previous run.

Common situations: Reading combined console output from setup-auth and wondering whether the run succeeded; codex silently authenticating with old tokens after an env-config regression.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/a6a9d88915d0f124. Report an issue: GitHub.