paperclipai/paperclip · error · AdapterAuthSessionConflictError
An adapter login session is already active for this company
Error message
An adapter login session is already active for this company and adapter.
What it means
Conflict guard when inserting a new adapterAuthSessions row: the unified sessions table already has an active (non-terminal) login session for the same company and adapterType. The unique-active-session invariant means a second concurrent login cannot be started; finish or cancel the existing session first.
Source
Thrown at server/src/services/codex-device-login-service.ts:469
await db.insert(adapterAuthSessions).values({
id: input.id,
companyId: input.companyId,
environmentId: input.environmentId,
adapterType: input.adapterType,
startedByUserId: input.startedByUserId,
// The unified table requires a unique public session id. The service
// builds it from a CSPRNG and returns it to the client, so the store
// persists that value here. It never uses the internal id, a timestamp,
// or a counter.
publicSessionId: input.publicSessionId,
status: "starting",
expiresAt: input.expiresAt,
createdAt: input.at,
updatedAt: input.at,
});
} catch (error) {
if (isUniqueViolation(error)) {
throw new AdapterAuthSessionConflictError();
}
throw error;
}
},
async recordLeaseAcquired(input) {
await db
.update(adapterAuthSessions)
.set({ providerLeaseId: input.providerLeaseId, updatedAt: input.at })
.where(eq(adapterAuthSessions.id, input.sessionId));
},
async setStatus(input) {
await db
.update(adapterAuthSessions)
.set(buildStatusPatch(input))
.where(eq(adapterAuthSessions.id, input.sessionId));
},
async compareAndSetStatus(input) {
// The conditional write. It changes the row only when the current status isView on GitHub (pinned to a7e689b3c3)
Solutions
- Wait for or cancel the active login session for this company and adapter before starting a new one.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/codex-device-login-service.ts:437 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18).
Data as JSON: /api/errors/35ce8ee48efa7859.
Report an issue: GitHub.