code: def error_incompatible_versions(
      client_version: Optional[str],
      server_version: str,
      ask_cli_update: bool,
  ) -> JSONResponse:
      msg = f"The client/CLI version ({client_version}) is incompatible with the server version ({server_version})."
      if ask_cli_update:
          msg += f" Update the dstack CLI: `pip install dstack=={server_version}`."
      return JSONResponse(
          status_code=status.HTTP_400_BAD_REQUEST,
          content={
              "detail": get_server_client_error_details(
                  ServerClientError(msg=msg)
              )
          },
      )
  
file_path: dstack/src/dstack/_internal/server/utils/routers.py
imports: from typing import Dict, List, Optional
  from fastapi import HTTPException, Request, Response, status
  from fastapi.responses import JSONResponse
  from packaging import version
  from dstack._internal.core.errors import ServerClientError
  from dstack._internal.server import settings
label_desc: Use image node_id 9 for calling a global function with example usage: error_incompatible_versions(client_version, server_version, ask_cli_update) and returns: JSONResponse