:doc:`SFN <../../stepfunctions>` / Client / send_task_failure

*****************
send_task_failure
*****************



.. py:method:: SFN.Client.send_task_failure(**kwargs)

  

  Used by activity workers, Task states using the `callback <https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token>`__ pattern, and optionally Task states using the `job run <https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync>`__ pattern to report that the task identified by the ``taskToken`` failed.

   

  For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key for the execution role.

   

  A caller can mark a task as fail without using any KMS permissions in the execution role if the caller provides a null value for both ``error`` and ``cause`` fields because no data needs to be encrypted.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/states-2016-11-23/SendTaskFailure>`_  


  **Request Syntax**
  ::

    response = client.send_task_failure(
        taskToken='string',
        error='string',
        cause='string'
    )
    
  :type taskToken: string
  :param taskToken: **[REQUIRED]** 

    The token that represents this task. Task tokens are generated by Step Functions when tasks are assigned to a worker, or in the `context object <https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html>`__ when a workflow enters a task state. See  GetActivityTaskOutput$taskToken.

    

  
  :type error: string
  :param error: 

    The error code of the failure.

    

  
  :type cause: string
  :param cause: 

    A more detailed explanation of the cause of the failure.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`SFN.Client.exceptions.TaskDoesNotExist`

  
  *   :py:class:`SFN.Client.exceptions.InvalidToken`

  
  *   :py:class:`SFN.Client.exceptions.TaskTimedOut`

  
  *   :py:class:`SFN.Client.exceptions.KmsAccessDeniedException`

  
  *   :py:class:`SFN.Client.exceptions.KmsInvalidStateException`

  
  *   :py:class:`SFN.Client.exceptions.KmsThrottlingException`

  