Execution failure in 'generateReply': (TypeError) unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Jakub Szura 45 Reputation points
2024-09-27T13:08:33.0133333+00:00

Hello,

I have been running automated evaluations and they were all succesfull when all of a sudden I started getting this error. In prompflow everything was working correctly. I decided to just wait but later I did small text changes to my promptflow and then deployed it to my real time endpoint and it broke it completely. Again, in promptflow everything works but once deployed it can't answer anything just always returns this error:

Execution failure in 'generateReply': (TypeError) unsupported operand type(s) for +: 'NoneType' and 'NoneType'

I have tried completely redoing the promptflow and it's the same issue. Can somebody help?

[2024-09-27 13:09:39 +0000][pfserving-app][ERROR] - Flow run failed with error: {'message': "Execution failure in 'generateReply': (TypeError) unsupported operand type(s) for +: 'NoneType' and 'NoneType'", 'messageFormat': "Execution failure in '{node_name}'.", 'messageParameters': {'node_name': 'generateReply'}, 'referenceCode': 'Tool/promptflow.executor.flow_executor', 'code': 'UserError', 'innerError': {'code': 'ToolExecutionError', 'innerError': None}, 'additionalInfo': [{'type': 'ToolExecutionErrorDetails', 'info': {'type': 'TypeError', 'message': "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", 'traceback': 'Traceback (most recent call last):\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1344, in wrapper\n    return f(*args, **kwargs)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 561, in wrapped\n    token_collector.collect_openai_tokens_for_parent_span(span)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 143, in collect_openai_tokens_for_parent_span\n    merged_tokens = {\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 144, in <dictcomp>\n    key: self._span_id_to_tokens[parent_span_id].get(key, 0) + tokens.get(key, 0)\nTypeError: unsupported operand type(s) for +: \'NoneType\' and \'NoneType\'\n', 'filename': '/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py', 'lineno': 144, 'name': '<dictcomp>'}}], 'debugInfo': {'type': 'ToolExecutionError', 'message': "Execution failure in 'generateReply': (TypeError) unsupported operand type(s) for +: 'NoneType' and 'NoneType'", 'stackTrace': '\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1034, in _exec\n    output, aggregation_inputs = self._exec_inner_with_trace(\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 937, in _exec_inner_with_trace\n    output, nodes_outputs = self._traverse_nodes(inputs, context)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1215, in _traverse_nodes\n    nodes_outputs, bypassed_nodes = self._submit_to_scheduler(context, inputs, batch_nodes)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1270, in _submit_to_scheduler\n    return scheduler.execute(self._line_timeout_sec)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 131, in execute\n    raise e\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 113, in execute\n    self._dag_manager.complete_nodes(self._collect_outputs(completed_futures))\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 160, in _collect_outputs\n    each_node_result = each_future.result()\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/_base.py", line 439, in result\n    return self.__get_result()\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result\n    raise self._exception\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/thread.py", line 58, in run\n    result = self.fn(*self.args, **self.kwargs)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 181, in _exec_single_node_in_thread\n    result = context.invoke_tool(node, f, kwargs=kwargs)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 90, in invoke_tool\n    result = self._invoke_tool_inner(node, f, kwargs)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 206, in _invoke_tool_inner\n    raise ToolExecutionError(node_name=node_name, module=module) from e\n', 'innerException': {'type': 'TypeError', 'message': "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", 'stackTrace': 'Traceback (most recent call last):\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 182, in _invoke_tool_inner\n    return f(**kwargs)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1344, in wrapper\n    return f(*args, **kwargs)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 561, in wrapped\n    token_collector.collect_openai_tokens_for_parent_span(span)\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 143, in collect_openai_tokens_for_parent_span\n    merged_tokens = {\n  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 144, in <dictcomp>\n    key: self._span_id_to_tokens[parent_span_id].get(key, 0) + tokens.get(key, 0)\n', 'innerException': None}}}
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,895 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Sina Salam 12,001 Reputation points
    2024-09-27T16:08:19.2166667+00:00

    Hello Jakub Szura,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having an "Execution failure in 'generateReply': (TypeError) unsupported operand type(s) for +: 'NoneType' and 'NoneType'" in Azure AI Service.

    To troubleshoot for best solution, let all variables you are using or that are involved in the operation are not None and all functions you used should return the expected values and if any function will return None, handle this case explicitly. For an example to handle None values in Python:

    def safe_addition(a, b):
        if a is None or b is None:
            return 0  # or some other default value
        return a + b
    result = safe_addition(variable1, variable2)
    

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    0 comments No comments

  2. YutongTie-MSFT 52,686 Reputation points
    2024-09-29T09:52:31.3433333+00:00

    Hello everyone,

    Thanks for reporting this issue, product team has acknowledged this issue and working on a fix. Will update here again if the issue has any progress.

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.


  3. Jakub Szura 45 Reputation points
    2024-10-03T12:15:37.61+00:00

    @YutongTie-MSFT
    Can we apply some temporary fix for running the evaluations? The promptflow with one of the fixes generates answers but the evaluators fail with the same error.

    2024-10-03 11:38:09 +0000     327 execution          ERROR    Node run_gpt_fluency_evaluator in line 380 failed. Exception: Execution failure in 'run_gpt_fluency_evaluator': (TypeError) unsupported operand type(s) for +: 'NoneType' and 'NoneType'.
    Traceback (most recent call last):
      File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 182, in _invoke_tool_inner
        return f(**kwargs)
      File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 561, in wrapped
        token_collector.collect_openai_tokens_for_parent_span(span)
      File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 143, in collect_openai_tokens_for_parent_span
        merged_tokens = {
      File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 144, in <dictcomp>
        key: self._span_id_to_tokens[parent_span_id].get(key, 0) + tokens.get(key, 0)
    TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
    
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.