xai-org/x-algorithm · warning · FutureWarning
Config '{key}' is deprecated and will be removed soon; use '
Error message
Config '{key}' is deprecated and will be removed soon; use '{normalized}' instead. What it means
FutureWarning emitted by __getitem__ of the xrecsys config registry when a deprecated config key is used. The key is normalized to its replacement before lookup, so the call still succeeds, but the old name will stop working in a future release.
Source
Thrown at phoenix/xrex/configs/xrecsys.py:509
class _ConfigRegistry(dict[str, RecsysTrainer]):
_DEPRECATED_POSTFIX: str = "_mask_old_bidir"
@classmethod
def _normalize_key(cls, key: str) -> tuple[str, bool]:
if key.endswith(cls._DEPRECATED_POSTFIX):
return key[: -len(cls._DEPRECATED_POSTFIX)], True
return key, False
def __contains__(self, key: object) -> bool:
if not isinstance(key, str):
return super().__contains__(key)
normalized, _ = self._normalize_key(key)
return super().__contains__(normalized)
def __getitem__(self, key: str) -> RecsysTrainer:
normalized, deprecated = self._normalize_key(key)
if deprecated:
warnings.warn(
f"Config '{key}' is deprecated and will be removed soon; use '{normalized}' instead.",
FutureWarning,
stacklevel=2,
)
return super().__getitem__(normalized)
def get(self, key: str, default: RecsysTrainer | None = None) -> RecsysTrainer | None:
normalized, deprecated = self._normalize_key(key)
if deprecated:
warnings.warn(
f"Config '{key}' is deprecated and will be removed soon; use '{normalized}' instead.",
FutureWarning,
stacklevel=2,
)
return super().get(normalized, default)
CONFIGS: dict[str, RecsysTrainer] = _ConfigRegistry()View on GitHub (pinned to 24c60942c5)
Solutions
- Rename the key to the normalized replacement shown in the warning message
- Grep the repo/notebook for the deprecated key and update all uses
- Run with -W error::FutureWarning temporarily to find every occurrence
Example fix
# before trainer = configs["ranking_aggregated"] # after trainer = configs[normalized_key_from_warning]
Defensive patterns
Strategy: validation
Validate before calling
normalized, deprecated = configs._normalize_key(key) if deprecated: key = normalized
Try / catch
with warnings.catch_warnings(record=True) as w:
v = configs[key]
deprecated_keys.update(x.message for x in w if issubclass(x.category, FutureWarning)) Prevention
- Run test suites with -W error::FutureWarning to catch deprecations early
- Wrap config access in a helper that normalizes keys once
When it happens
Trigger: Indexing the config mapping (configs["old_name"]) with a key that _normalize_key flags as deprecated.
Common situations: Notebooks or training scripts written against older config names after a renaming migration; copy-pasted config keys from old runbooks.
Related errors
- Your config needs a global variable named CONFIGS
- Config module {mod_name!r} has no key {ver!r}. Closest match
- Uknown {dataset_type=}, must be one of {DATASET_TYPES}
- Unknown {dataset_type=}, must be one of {DATASET_TYPES}
- Unknown {dataset_type=} for the SID retrieval family
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/d41b320a6bc2f465.
Report an issue: GitHub.