{"record":{"id":"4ea5850f80db0d3f","repo":"xai-org/x-algorithm","slug":"no-user-actions","errorCode":null,"errorMessage":"no user_actions","messagePattern":"no user_actions","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"bdsm/rust/abuse-v3-features/src/lib.rs","lineNumber":260,"sourceCode":"    let decompressed = zstd::decode_all(Cursor::new(raw))?;\n    let cursor = Cursor::new(decompressed);\n    let reader = FileReader::try_new(cursor, None)?;\n    let mut batches = Vec::new();\n    for b in reader {\n        batches.push(b?);\n    }\n    if batches.is_empty() {\n        anyhow::bail!(\"empty\");\n    }\n    let batch = if batches.len() == 1 {\n        batches.into_iter().next().unwrap()\n    } else {\n        arrow::compute::concat_batches(&batches[0].schema(), &batches)?\n    };\n\n    let actions_col = batch\n        .column_by_name(\"user_actions\")\n        .ok_or_else(|| anyhow::anyhow!(\"no user_actions\"))?;\n    let list = actions_col\n        .as_any()\n        .downcast_ref::<ListArray>()\n        .ok_or_else(|| anyhow::anyhow!(\"not ListArray\"))?;\n    if list.is_empty() || list.is_null(0) {\n        anyhow::bail!(\"empty list\");\n    }\n\n    let vals = list.value(0);\n    let sa = vals\n        .as_any()\n        .downcast_ref::<StructArray>()\n        .ok_or_else(|| anyhow::anyhow!(\"not StructArray\"))?;\n    let total = sa.len();\n    if total == 0 {\n        anyhow::bail!(\"zero actions\");\n    }\n","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/bdsm/rust/abuse-v3-features/src/lib.rs#L242-L278","documentation":"extract_single_user_arrow expects an Arrow RecordBatch containing a column named 'user_actions'. When column_by_name returns None (the column is absent from the batch schema), this error is raised. It typically means upstream data production and this consumer disagree on the expected schema.","triggerScenarios":"Calling extract_batch / extract_single_user_arrow on a batch whose schema lacks a 'user_actions' field — e.g. an empty concat input, a renamed column, or a producer writing a different feature schema version.","commonSituations":"Upstream feature pipeline renamed or dropped the user_actions column, schema drift between producer and consumer versions, or an accidentally empty/mis-routed dataset being fed into the extractor.","solutions":["Inspect batch.schema() field names to confirm what the producer actually sent","Align the consumer schema with the producer: fix the column name or update this code to the new field name","Add a schema assertion/validation step before calling extract to fail fast with a clearer message","Pin producer and consumer to compatible schema versions in deployment"],"exampleFix":"// before\nlet actions_col = batch\n    .column_by_name(\"user_actions\")\n    .ok_or_else(|| anyhow::anyhow!(\"no user_actions\"))?;\n\n// after\nlet actions_col = batch\n    .column_by_name(\"user_actions\")\n    .ok_or_else(|| anyhow::anyhow!(\n        \"no user_actions: batch schema has fields {:?}\",\n        batch.schema().fields().iter().map(|f| f.name()).collect::<Vec<_>>()\n    ))?;","handlingStrategy":"validation","validationCode":"// Validate the batch schema before extraction\nlet expected = Schema::new(vec![Field::new(\"user_actions\", DataType::List(Arc::new(Field::new(\"item\", ActionType::data_type(), true))), false)]);\nanyhow::ensure!(batch.schema().contains(&expected) || batch.column_by_name(\"user_actions\").is_some(), \"unexpected batch schema\");","typeGuard":"fn has_user_actions(batch: &RecordBatch) -> bool {\n    batch.column_by_name(\"user_actions\").is_some()\n}","tryCatchPattern":"// catch and report the actual schema for fast diagnosis\nmatch extract_batch(batches) {\n    Err(e) if e.to_string().contains(\"no user_actions\") => {\n        tracing::error!(\"schema drift: got fields {:?}\", batch.schema());\n        return Err(e);\n    }\n    r => r,\n}","preventionTips":["Assert the expected schema at producer and consumer startup","Version the feature schema and gate deploys on compatibility checks","Log the full schema on extraction failures to speed up drift diagnosis"],"tags":["rust","arrow","schema-mismatch","missing-column","data-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}