ComposioHQ/composio · error · ValueError

response is required for after_execute_meta

Error message

response is required for after_execute_meta

What it means

Raised when apply_modifier_by_type is invoked with type=after_execute_meta but response is None. after_execute_meta modifiers post-process a tool's execution response, so a response object is mandatory; the library refuses to guess and fails fast.

Source

Thrown at python/composio/core/models/_modifiers.py:641

                raise ValueError("params is required for before_execute_meta")
            result_params: t.Dict[str, t.Any] = params
            for modifier in modifiers:
                if modifier.type == type:
                    # Check if modifier should be applied
                    should_apply = (
                        (len(modifier.tools) == 0 and len(modifier.toolkits) == 0)
                        or tool in modifier.tools
                        or toolkit in modifier.toolkits
                    )

                    if should_apply and modifier.modifier is not None:
                        result_params = t.cast(BeforeExecuteMeta, modifier.modifier)(
                            tool, toolkit, session_id, result_params
                        )
            return result_params
        else:  # after_execute_meta
            if response is None:
                raise ValueError("response is required for after_execute_meta")
            result_response: "ToolExecutionResponse" = response
            for modifier in modifiers:
                if modifier.type == type:
                    # Check if modifier should be applied
                    should_apply = (
                        (len(modifier.tools) == 0 and len(modifier.toolkits) == 0)
                        or tool in modifier.tools
                        or toolkit in modifier.toolkits
                    )

                    if should_apply and modifier.modifier is not None:
                        result_response = t.cast(AfterExecuteMeta, modifier.modifier)(
                            tool, toolkit, session_id, result_response
                        )
            return result_response

    # For regular modifiers
    result: ModifierInOut

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Ensure a ToolExecutionResponse exists before applying after_execute_meta modifiers — only register after_execute_meta modifiers on the post-response path of your pipeline
  2. If you meant to mutate input parameters before execution, use type='before_execute' instead of 'after_execute_meta'
  3. Check that the tool execution actually succeeded and produced a response before your wrapper calls the modifier layer
  4. Upgrade @composio/core / composio packages to matching versions in case modifier type strings changed between releases

Example fix

# before
toolkit.add_modifier(my_modifier, type="after_execute_meta")
# applied in a code path where response is None

# after
if response is not None:
    toolkit.add_modifier(my_modifier, type="after_execute_meta")
# or, for pre-execution param mutation:
toolkit.add_modifier(my_modifier, type="before_execute")
Defensive patterns

Strategy: type-guard

Validate before calling

if response is None:
    raise RuntimeError("tool execution produced no response; skipping after_execute_meta modifiers")
result = apply_modifier_by_type(modifiers, "after_execute_meta", response=response, ...)

Type guard

def has_response(exec) -> TypeGuard[ToolExecutionResponse]:
    return getattr(exec, "response", None) is not None

Try / catch

try:
    apply_modifier_by_type(modifiers, "after_execute_meta", response=response, ...)
except ValueError as e:
    if "response is required" in str(e):
        logger.warning("no response to post-process; skipping modifier")
    else:
        raise

Prevention

When it happens

Trigger: Calling Composio's modifier application path with modifier type 'after_execute_meta' (e.g. toolkit.add_modifier(..., type='after_execute_meta') and then executing/routing a tool where no ToolExecutionResponse was produced or passed through, such as a dry-run, an execution that failed before producing a response, or custom code calling apply_modifier_by_type directly without response).

Common situations: Custom middleware or frameworks wrapping Composio tool execution that intercept before a response exists; failed upstream tool executions; version changes that renamed before/after modifier types causing the wrong branch to be selected.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/10f0318c228f2018. Report an issue: GitHub.