{"record":{"id":"012e08ba066a4d2b","repo":"mem0ai/mem0","slug":"jwt-secret-is-not-configured","errorCode":null,"errorMessage":"JWT_SECRET is not configured.","messagePattern":"JWT_SECRET is not configured\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"server/auth.py","lineNumber":53,"sourceCode":"    pwd_context.dummy_verify()\n\n\ndef generate_api_key() -> tuple[str, str, str]:\n    \"\"\"Returns (full_key, prefix, hash).\"\"\"\n    raw = secrets.token_urlsafe(32)\n    full_key = f\"m0sk_{raw}\"\n    prefix = full_key[:12]\n    key_hash = pwd_context.hash(full_key)\n    return full_key, prefix, key_hash\n\n\ndef verify_api_key_hash(plain_key: str, hashed: str) -> bool:\n    return pwd_context.verify(plain_key, hashed)\n\n\ndef _get_secret() -> str:\n    if not JWT_SECRET:\n        raise HTTPException(status_code=500, detail=\"JWT_SECRET is not configured.\")\n    return JWT_SECRET\n\n\ndef create_access_token(user_id: str, role: str) -> str:\n    expire = datetime.now(timezone.utc) + timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)\n    payload = {\"sub\": user_id, \"role\": role, \"exp\": expire, \"type\": \"access\"}\n    return jwt.encode(payload, _get_secret(), algorithm=JWT_ALGORITHM)\n\n\ndef create_refresh_token(user_id: str, db: Session) -> str:\n    expire = datetime.now(timezone.utc) + timedelta(days=REFRESH_TOKEN_EXPIRE_DAYS)\n    jti = uuid.uuid4()\n    db.add(RefreshTokenJti(jti=jti, user_id=uuid.UUID(user_id), expires_at=expire))\n    db.commit()\n    payload = {\"sub\": user_id, \"exp\": expire, \"jti\": str(jti), \"type\": \"refresh\"}\n    return jwt.encode(payload, _get_secret(), algorithm=JWT_ALGORITHM)\n\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/server/auth.py#L35-L71","documentation":"Error \"JWT_SECRET is not configured.\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at server/auth.py:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set JWT_SECRET in the server .env (generate with `openssl rand -base64 48`) or set AUTH_DISABLED=true for local development."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}