louislam/dockge · error · Error

You are not logged in.

Error message

You are not logged in.

What it means

checkLogin() in backend/util-server.ts guards every authenticated socket handler: if the socket has no userID (login did not happen or the session was lost), it throws 'You are not logged in.'. Dockge handlers call it first so unauthenticated clients can never touch stacks, files, or user data. It is called by handlers such as create/create2.

Source

Thrown at backend/util-server.ts:44

    sslKey? : string;
    sslCert? : string;
    sslKeyPassphrase? : string;
    port? : number;
    hostname? : string;
    dataDir? : string;
    stacksDir? : string;
    enableConsole? : boolean;
}

// Some config values are required
export interface Config extends Arguments {
    dataDir : string;
    stacksDir : string;
}

export function checkLogin(socket : DockgeSocket) {
    if (!socket.userID) {
        throw new Error("You are not logged in.");
    }
}

export class ValidationError extends Error {
    constructor(message : string) {
        super(message);
    }
}

export function callbackError(error : unknown, callback : unknown) {
    if (typeof(callback) !== "function") {
        log.error("console", "Callback is not a function");
        return;
    }

    if (error instanceof Error) {
        callback({
            ok: false,

View on GitHub (pinned to f809ae192b)

Solutions

  1. Log in again from the Dockge UI to establish a new authenticated socket session
  2. Reload the page so the frontend reconnects and re-authenticates the socket
  3. In custom clients, perform the login event first and only then call protected actions
  4. Check server logs for token/auth errors if login appears to succeed but the error persists

Example fix

// before (custom client calls protected handler directly)
socket.emit("createStack", name, ...);
// after
socket.emit("login", username, password, (res) => {
  if (res.ok) socket.emit("createStack", name, ...);
});
Defensive patterns

Strategy: type-guard

Validate before calling

// client-side: only emit protected events with an authenticated socket
if (socket.userID) {
  socket.emit("createStack", name, composeYAML);
} else {
  redirectToLogin();
}

Type guard

function isLoggedIn(socket) {
  return typeof socket.userID === "string" && socket.userID.length > 0;
}

Try / catch

try {
  checkLogin(socket);
  // ... protected handler body
} catch (e) {
  if (e.message === "You are not logged in.") {
    socket.emit("authError", "Please log in again."); // prompt re-login client-side
  } else throw e;
}

Prevention

When it happens

Trigger: Emitting a socket event that calls checkLogin (e.g. createStack, create2) from a socket that never completed the login handshake, whose token was rejected, or whose session was cleared (server restart, token expiry).

Common situations: Frontend kept open across a Dockge server restart, so the old socket lacks a userID; scripts/automation hitting the socket API without logging in; expired or revoked JWT after password change.

Related errors


AI-assisted analysis of louislam/dockge@f809ae192b (2026-08-31). Data as JSON: /api/errors/fa5a06da6634193d. Report an issue: GitHub.