vectordotdev/vector · error

Called `Transform::into_task` on something that was not a…

Error message

Called `Transform::into_task` on something that was not a task variant.

What it means

Transform::into_task converts an enum-wrapped transform into its boxed TaskTransform variant. Because the enum also holds non-task variants (e.g. FunctionTransform), the method can only be called on the Task variant; any other variant hits an explicit panic, since a function transform has no task representation.

Solutions

  1. Check which variant the Transform holds before calling into_task (add a Transform::is_task_style()/matches! check)
  2. Use the appropriate accessor for function transforms instead of into_task
  3. Update the construction site so the transform is built as Transform::Task

Example fix

// before
let task = transform.into_task();
// after
assert!(transform.is_task_style(), "transform {:?} is not a task transform", transform);
let task = transform.into_task();
Defensive patterns

Strategy: type-guard

Validate before calling

if !transform.is_task_style() {
    return Err(anyhow!("transform is not task-style; cannot call into_task"));
}

Type guard

fn is_task(t: &Transform) -> bool { matches!(t, Transform::Task(_)) }

Prevention

When it happens

Trigger: Calling into_task() on a Transform constructed from a function-style transform (one implementing FunctionTransform) or from any non-Task variant instead of a task-style transform.

Common situations: Config/topology builders that generically iterate over transforms from configuration and assume all are task transforms; refactors where a transform was changed from task-style to function-style but call sites were not updated.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/fcb6987ff87cbe59. Report an issue: GitHub.

Appendix: source

Thrown at lib/vector-core/src/transform/mod.rs:84

    /// where possible.
    ///
    /// # Panics
    ///
    /// TODO
    pub fn event_task(v: impl TaskTransform<Event> + 'static) -> Self {
        Transform::Task(Box::new(WrapEventTask(v)))
    }

    /// Transmute the inner transform into a task transform.
    ///
    /// # Panics
    ///
    /// If the transform is a [`FunctionTransform`] this will panic.
    pub fn into_task(self) -> Box<dyn TaskTransform<EventArray>> {
        match self {
            Transform::Task(t) => t,
            _ => {
                panic!("Called `Transform::into_task` on something that was not a task variant.")
            }
        }
    }
}

/// Transforms that are simple, and don't require attention to coordination.
/// You can run them as simple functions over events in any order.
///
/// # Invariants
///
/// * It is an illegal invariant to implement `FunctionTransform` for a
///   `TaskTransform` or vice versa.
pub trait FunctionTransform: Send + dyn_clone::DynClone + Sync {
    fn transform(&mut self, output: &mut OutputBuffer, event: Event);
}

dyn_clone::clone_trait_object!(FunctionTransform);

View on GitHub (pinned to bdb87aeaa4)