Skip to content

Server won't start when server-signing-key.bin is empty ("Mac.key: An HMAC key cannot be empty") #32026

Open

Description

@bdamokos

What happened

"It did not start after an update." The desktop app showed "The server could not start (code=1)" with CryptoError: Mac.key: An HMAC key cannot be empty. The backend failed on every start and the app kept retrying about every 10 seconds. An earlier run of the same failure reached about 2,950 attempts overnight.

Diagnosis

ServerSecretStore.getOrCreateRandom returns any existing secret file without checking its length, so a 0-byte server-signing-key.bin counts as a valid key.

Before #30501 and #30523, signing used NodeCrypto.createHmac, which accepts an empty key, so the bad file went unnoticed. SessionStore now calls PayloadSigner.fromSecret while the server starts, and Mac.key rejects empty keys, so the server exits. Going back to nightly 20261104.4165, which has neither PR, starts normally.

How the file became empty is unknown. It was last modified on 2026-04-11. Current code writes these keys through a temp file and a link, so it may come from an older build.

The code paths are the same on main @ 6577c6b. A possible fix: treat an empty secret as missing or corrupt in getOrCreateRandom, and generate a new one.

Steps to reproduce

  1. Quit T3 Code.
  2. Replace <state dir>/secrets/server-signing-key.bin with a 0-byte file.
  3. Start a build that includes refactor(server): sign server tokens through PayloadSigner #30523 (first seen in nightly 20261104.4192).
  4. The backend exits with code 1 and the error above.

Inferred from the source and this install. Not run on a clean setup.

Version

0.1.8-nightly.20261106.4262 (desktop); first failure 2026-11-04 22:48 UTC, build not recorded

Environment

macOS (Darwin 27.0.0), arm64; desktop app (Nightly) with its local server

Evidence

CryptoError: Mac.key: An HMAC key cannot be empty
    at PayloadSigner.fromSecret (Nightly)
    at server.runServerCommand (Nightly)
    at server.runDefaultServerCommand (Nightly)

Trace: ServerSecretStore.getOrCreateRandom succeeds, then PayloadSigner.fromSecret fails about 0.1 ms later.
File sizes: server-signing-key.bin 0 bytes; mcp-oauth-signing-key.bin and asset-access-signing-key.bin 32 bytes.

Related issues

No matching issue found. Related PRs: #30501, #30523.

Fix applied or workaround

Deleted the 0-byte server-signing-key.bin and reopened the app. The server generated a new 32-byte key and started on the same build. Existing sessions may need to sign in again.

Filed by

Claude Code (claude-opus-5-5) via t3 triage

Activity

  1. shivamhwp commented on Nov 7, 2026

    @shivamhwp
    Collaborator

    [GPT-6.1 Sol][Codex] on behalf of shivam.

    Issue watch found Julius has taken this over in #32053 at fa43bdc, which closes this issue. The current ServerSecretStore path still returns an existing empty file, matching the reported cause. The PR includes empty-key recovery and concurrent-caller regression coverage, plus a before/after server startup transcript. I am stopping this duplicate job. I did not run additional tests or verify the macOS or Linux desktop app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions