{"record":{"id":"4851934991ccc858","repo":"xai-org/x-algorithm","slug":"unknown-strategy-strategy-r","errorCode":null,"errorMessage":"Unknown strategy: {strategy!r}","messagePattern":"Unknown strategy: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/models/recsys_model.py","lineNumber":130,"sourceCode":"    impr_ts_sec: jax.Array,\n    post_creation_ts_sec: jax.Array,\n    granularity_mins: int = 60,\n    max_mins: int = POST_AGE_MAX_MINUTES,\n    strategy: Literal[\"linear\", \"log1p\"] = \"linear\",\n    num_buckets: int = 80,\n) -> jax.Array:\n    post_age_minutes = (impr_ts_sec - post_creation_ts_sec) // 60\n\n    if strategy == \"linear\":\n        n_buckets = max_mins // granularity_mins\n        bucket = (post_age_minutes // granularity_mins) + 1\n    elif strategy == \"log1p\":\n        n_buckets = num_buckets\n        log_max = math.log1p(max_mins)\n        clamped_age = jnp.maximum(post_age_minutes, 0).astype(jnp.float32)\n        bucket = jnp.floor(jnp.log1p(clamped_age) / log_max * n_buckets).astype(jnp.int32) + 1\n    else:\n        raise ValueError(f\"Unknown strategy: {strategy!r}\")\n\n    overflow_bucket = n_buckets + 1\n    bucket = jnp.clip(bucket, 0, overflow_bucket)\n\n    bucket = jnp.where(\n        (post_age_minutes < 0) | (impr_ts_sec == 0) | (post_creation_ts_sec == 0),\n        0,\n        bucket,\n    )\n    return bucket.astype(jnp.int32)\n\n\nENGAGEMENT_COUNT_NUM_BUCKETS = 32\nENGAGEMENT_COUNT_MAX_BUCKET: dict[CategoricalFeature, int] = {\n    CategoricalFeature.favCountBucketSeq: 18,\n    CategoricalFeature.replyCountBucketSeq: 13,\n    CategoricalFeature.repostCountBucketSeq: 15,\n    CategoricalFeature.quoteCountBucketSeq: 13,","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/models/recsys_model.py#L112-L148","documentation":"compute_post_age_bucket maps post age (minutes) into buckets using the configured strategy; implemented strategies include (per the source) an earlier branch and 'log1p' (floor(log1p(age)/log1p(max_mins) * n_buckets) + 1). Any other strategy string raises ValueError, and the resulting bucket is clipped to [0, n_buckets + 1] with an overflow bucket.","triggerScenarios":"Calling build_inputs with post_age_bucket_strategy set to e.g. \"sqrt\", \"linear \", or \"Log1P\" (case-sensitive) in the model config.","commonSituations":"Experimenting with bucketing schemes; porting configs between versions where strategy names changed.","solutions":["Use a strategy implemented in compute_post_age_bucket (check the branches in recsys_model.py, e.g. 'log1p').","Fix typos/casing in the config string.","Add an elif branch for a new strategy if the bucketing math is known."],"exampleFix":"# before\npost_age_bucket_strategy: log\n\n# after\npost_age_bucket_strategy: log1p","handlingStrategy":"validation","validationCode":"assert strategy in {\"linear\", \"log1p\"}, strategy  # mirror implemented branches","typeGuard":"def is_supported_bucket_strategy(s: str) -> bool:\n    return s in {\"linear\", \"log1p\"}","tryCatchPattern":null,"preventionTips":["Validate bucketing strategy strings when parsing feature configs."],"tags":["feature-engineering","bucketing","enum-validation","recsys"],"backgroundTag":"invalid-config-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}