Yeachan-Heo/oh-my-codex · error · SessionPointerLaunchAbort
session_pointer_context_failure
session_pointer_context_failure
Error message
Unable to resolve the selected session pointer root: ${errorMessage(cause)} What it means
resolveSessionPointerContext(cwd) threw while setting up a session-pointer teardown (end-session) operation, and the error is re-surfaced through contextAbort — i.e. the session pointer root (state dir / lock path derived from cwd) could not be resolved for this working directory. The subsequent missing-session-ID guard shown would raise session_pointer_io_failure instead; this message corresponds to the context-resolution failure path (contextAbort / session_pointer_context_failure).
Source
Thrown at src/hooks/session.ts:3623
/**
* Archive first and remove an owned pointer only after that history write
* succeeds. Present unusable pointer evidence is never repaired or archived.
*/
export async function writeSessionEnd(
cwd: string,
sessionId: string,
options: Pick<SessionStartOptions, 'context' | 'platform' | 'regularFileSync'> & {
binding?: LaunchSessionBinding;
postLaunchCwd?: string;
} = {},
): Promise<{ comparison: LifecycleCleanupEvidence['comparison']; capability: CapabilityCloseEvidence[] }> {
const candidateSessionId = normalizeSessionId(sessionId);
let context: SessionPointerContext;
try {
context = options.context ?? resolveSessionPointerContext(cwd);
} catch (error) {
throw contextAbort(cwd, candidateSessionId, error);
}
if (!candidateSessionId) {
const cause = new Error('A valid session ID is required to end a session pointer.');
throw resolvedAbort(context, {
code: 'session_pointer_io_failure',
operation: 'pointer-classify',
lockPath: context.lockPath,
reason: cause.message,
cause,
});
}
if (!options.binding) {
throw resolvedAbort(context, {
code: 'session_pointer_io_failure', operation: 'pointer-classify', candidateSessionId,
lockPath: context.lockPath, reason: 'A live launch binding is required to end a session pointer.',
});
}View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Ensure the cwd you pass still exists (pwd works) and is absolute.
- Fix or unset the env var / config that determines the state root so it resolves to a real writable directory.
- mkdir -p the intended state root before calling endSession.
- If the process's cwd was deleted, restart the operation from a valid directory.
Example fix
// before await endSession(deletedCwd, sessionId); // after const cwd = fs.realpathSync(process.cwd()); // valid dir await endSession(cwd, sessionId);
Defensive patterns
Strategy: validation
Validate before calling
import { promises as fsp } from 'node:fs';
const abs = path.isAbsolute(cwd) ? cwd : path.resolve(cwd);
await fsp.access(abs); // throws if the directory is gone
await ensureStateRootWritable(); // mkdir -p the configured state root Type guard
const isExistingAbsDir = (p: unknown): p is string => typeof p === 'string' && path.isAbsolute(p) && fs.existsSync(p);
Try / catch
try { await endSession(cwd, sessionId); } catch (e) { if (isContextFailure(e)) { const safe = path.resolve(process.cwd()); return endSession(safe, sessionId); } throw e; } Prevention
- Validate cwd exists (and is absolute) before calling session APIs.
- Bootstrap the state root (mkdir -p) at process startup.
- Don't delete the working directory out from under a running process.
When it happens
Trigger: Calling endSession with a cwd for which the pointer context cannot be derived: the state root env/config resolves to an invalid path, realpath fails (ENOENT parents, permission denied), or platform context resolution rejects the directory.
Common situations: Running end-session from a deleted working directory (cwd removed by another process); STATE_DIR-style env var pointing to a nonexistent/unwritable path; nested containers where the cwd is a broken mount; calling with a cwd string that is not an absolute path.
Related errors
- session_pointer_owner_conflict
- status must be one of running, blocked, failed, complete
- autopilot.session_id must match the selected writable sessio
- Invalid team_name: "${rawTeamName}". Must match /^[a-z0-9][a
- Refusing a durable ultragoal mutation before writable lifecy
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/dc2e76387dad99f2.
Report an issue: GitHub.