jax-ml/jax · error · ValueError

Attempting to set log level "{logging_level}" which isn't on

Error message

Attempting to set log level "{logging_level}" which isn't one of the supported: {list(_tf_cpp_map.keys())}.

What it means

_set_cpp_min_log_level maps Python logging level names to TF/absl C++ levels via _tf_cpp_map. Passing a level string that isn't a key (e.g. 'DEBUG ' with whitespace, numeric 10, or 'verbose') raises ValueError listing the supported names. This runs whenever JAX updates its global logging level, typically from the jax_logging_level config.

Source

Thrown at jax/_src/logging_config.py:55

    'NOTSET': logging.NOTSET,
}

_tf_cpp_map = {
    'CRITICAL': 3,
    'FATAL': 3,
    'ERROR': 2,
    'WARN': 1,
    'WARNING': 1,
    'INFO': 0,
    'DEBUG': 0,
}

def _set_cpp_min_log_level(logging_level: str | None = None):
  if logging_level in (None, "NOTSET"):
    return
  # set cpp runtime logging level if the level is anything but NOTSET
  if logging_level not in _tf_cpp_map:
    raise ValueError(f"Attempting to set log level \"{logging_level}\" which"
                      f" isn't one of the supported:"
                      f" {list(_tf_cpp_map.keys())}.")
  # config the CPP logging level 0 - debug, 1 - info, 2 - warning, 3 - error
  log_level = _tf_cpp_map[logging_level]
  utils.absl_set_min_log_level(log_level)

def update_logging_level_global(logging_level: str | None) -> None:
  # remove previous handlers
  for logger_name, level in _logging_level_set.items():
    logger = logging.getLogger(logger_name)
    logger.removeHandler(_jax_logger_handler)
    logger.setLevel(level)
  _logging_level_set.clear()
  _set_cpp_min_log_level(logging_level)

  if logging_level is None:
    return

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Use one of the exact names in the error message (e.g. 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL')
  2. Check for typos, quotes, or whitespace in JAX_LOGGING_LEVEL env var values
  3. Strip/normalize the string before assigning: logging_level.strip().upper()
  4. If a number was passed, convert to the canonical name first

Example fix

# before
jax.config.update('jax_logging_level', 'verbose')

# after
jax.config.update('jax_logging_level', 'DEBUG')
Defensive patterns

Strategy: validation

Validate before calling

level = 'DEBUG'
from jax._src.logging_config import _tf_cpp_map  # or hardcode valid names
valid = {'DEBUG','INFO','WARNING','ERROR','FATAL'}
assert level in valid

Type guard

def is_valid_log_level(s: str) -> bool:
    return s in {'DEBUG','INFO','WARNING','ERROR','FATAL'}

Prevention

When it happens

Trigger: Setting jax_logging_level config or JAX_LOGGING_LEVEL env var to an unsupported value like 'debug' lowercase variants not in the map, '10', 'VERBOSE', or a misspelled level; calling update_logging_level_global('warn ') with trailing space.

Common situations: Setting JAX_LOGGING_LEVEL in a container/Dockerfile or CI with an invalid string; libraries like TensorFlow interacting with the shared absl config; version changes altering supported level names.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/77dcc32b9a8342bb. Report an issue: GitHub.