Troubleshooting

Overview

This guide covers common issues and solutions you may encounter when developing with Tasker and deploying Tasker-based workflows to production. It's organized into development-time issues and deployment-time issues for easy navigation.

Development Troubleshooting

Task Handler Issues

"Task handler not found" or "NameError: uninitialized constant"

Symptoms:

# Error when trying to create or execute tasks
NameError: uninitialized constant OrderProcess
# or
Tasker::TaskHandler::NotFoundError: Task handler 'order_process' not found

Common Causes & Solutions:

  1. File naming mismatch

    # Ensure file name matches class name
    app/tasks/order_process.rb  # File name should be snake_case
    class OrderProcess          # Class name should be CamelCase
  2. YAML configuration mismatch

    # config/tasker/tasks/order_process.yaml
    name: order_process                    # Must match file name
    task_handler_class: OrderProcess       # Must match class name exactly
  3. Module namespace issues

    # If using module namespaces, ensure they're consistent
    # YAML: module_namespace: ECommerce
    # File: app/tasks/e_commerce/order_process.rb
    module ECommerce
      class OrderProcess < Tasker::TaskHandler::Base
  4. Rails autoloading not picking up changes

    # Restart Rails server to reload task handlers
    bundle exec rails server
    
    # Or in development, force reload
    Rails.application.reloader.reload!

"Step handler not found" or Step execution failures

Symptoms:

Solutions:

  1. Check file structure and naming

  2. Verify YAML step configuration

  3. Check inheritance

Step Dependency Issues

Steps not executing in expected order

Symptoms:

  • Steps run simultaneously when they should be sequential

  • Steps wait indefinitely for dependencies

  • Circular dependency errors

Diagnosis & Solutions:

  1. Check dependency configuration

  2. Verify step names match exactly

  3. Check for circular dependencies

  4. Debug dependency resolution

Diamond pattern dependency issues

Problem: Steps with multiple dependency paths not executing correctly

Solution:

Step Implementation Issues

Steps marked as failed when they should succeed

Symptoms:

  • Step completes successfully but shows as "error" state

  • Expected return values not stored in step.results

Common Causes & Solutions:

  1. Exception handling masking success

  2. Incorrect return values

Data not passed between steps correctly

Symptoms:

  • Dependent steps can't access previous step results

  • nil or empty results from previous steps

Solutions:

  1. Check step name references

  2. Verify previous step completed successfully

  3. Handle missing or malformed results

Retry Logic Issues

Steps not retrying when they should

Symptoms:

  • Failed steps go directly to error state instead of retrying

  • Retry count not incrementing

Solutions:

  1. Check retry configuration

  2. Verify exception types

  3. Check retry state in database

Infinite retry loops

Symptoms:

  • Steps retry indefinitely

  • High CPU usage from constant retrying

Solutions:

  1. Check retry limits

  2. Implement exponential backoff awareness

JSON Schema Validation Issues

Task requests failing validation

Symptoms:

Solutions:

  1. Check schema definition in YAML

  2. Validate context before task creation

Deployment Troubleshooting

Observability & Monitoring

Tasks stuck in pending state

Symptoms:

  • Tasks created but never progress beyond 'pending'

  • No step execution occurring

Diagnosis Steps:

  1. Check ActiveJob backend

  2. Verify database connectivity

  3. Check SQL function availability

  4. Monitor workflow coordination

No step execution events

Symptoms:

  • Tasks and steps exist but no lifecycle events

  • Missing telemetry data

Solutions:

  1. Verify event system configuration

  2. Check event subscribers

  3. Enable telemetry

Performance Issues

Slow step readiness calculations

Symptoms:

  • Long delays between step completions and dependent step execution

  • High database CPU usage

Solutions:

  1. Check SQL function performance

  2. Verify database indexes

  3. Monitor function call frequency

Memory leaks in long-running tasks

Symptoms:

  • Memory usage grows over time

  • Application becomes unresponsive

Solutions:

  1. Check step result sizes

  2. Implement result cleanup

Error Analysis

Analyzing step failure patterns

Diagnostic Queries:

Debugging specific task execution

Logging & Observability Setup

Structured logging configuration

Custom event subscribers for monitoring

Production health checks

Diagnostic Tools & Commands

Useful Rails Console Commands

Database Queries for Analysis

Getting Help

Documentation Resources

Community & Support

  • Check the GitHub issues for similar problems

  • Review test examples in the spec/ directory

  • Examine example implementations in spec/examples/

Debug Mode

Enable verbose logging for deeper insight:

Remember: Tasker is designed to be resilient and self-healing. Many transient issues will resolve themselves through the retry mechanism. Focus on patterns of persistent failures rather than isolated incidents.

Last updated