code: def _print_fail_message(run: Run):
      error_code = _get_run_error_code(run)
      message = (
          "Run failed due to unknown reason. Check CLI and server logs."
      )
      if (
          _get_run_error_code(run)
          == JobErrorCode.FAILED_TO_START_DUE_TO_NO_CAPACITY
      ):
          message = (
              "All provisioning attempts failed. "
              "This is likely due to cloud providers not having enough capacity. "
              "Check CLI and server logs for more details."
          )
      elif error_code is not None:
          message = (
              f"Run failed with error code {error_code}. "
              "Check CLI and server logs for more details."
          )
      console.print(f"[error]{message}[/]")
  
imports: import argparse
  import sys
  import time
  from pathlib import Path
  from typing import Optional
  from dstack._internal.cli.commands import APIBaseCommand
  from dstack._internal.cli.services.configurators.profile import apply_profile_args, register_profile_args
  from dstack._internal.cli.services.configurators.run import BaseRunConfigurator, run_configurators_mapping
  from dstack._internal.cli.utils.common import confirm_ask, console
  from dstack._internal.cli.utils.run import print_run_plan
  from dstack._internal.core.errors import CLIError, ConfigurationError, ServerClientError
  from dstack._internal.core.models.configurations import ConfigurationType
  from dstack._internal.core.models.runs import JobErrorCode
  from dstack._internal.core.services.configs import ConfigManager
  from dstack._internal.utils.logging import get_logger
  from dstack.api import RunStatus
  from dstack.api._public.runs import Run
  from dstack.api.utils import load_configuration, load_profile
label_desc: Use image node_id 1 for calling a global function with example usage: _print_fail_message(run) without return types