{"record":{"id":"10f0318c228f2018","repo":"ComposioHQ/composio","slug":"response-is-required-for-after-execute-meta","errorCode":null,"errorMessage":"response is required for after_execute_meta","messagePattern":"response is required for after_execute_meta","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/composio/core/models/_modifiers.py","lineNumber":641,"sourceCode":"                raise ValueError(\"params is required for before_execute_meta\")\n            result_params: t.Dict[str, t.Any] = params\n            for modifier in modifiers:\n                if modifier.type == type:\n                    # Check if modifier should be applied\n                    should_apply = (\n                        (len(modifier.tools) == 0 and len(modifier.toolkits) == 0)\n                        or tool in modifier.tools\n                        or toolkit in modifier.toolkits\n                    )\n\n                    if should_apply and modifier.modifier is not None:\n                        result_params = t.cast(BeforeExecuteMeta, modifier.modifier)(\n                            tool, toolkit, session_id, result_params\n                        )\n            return result_params\n        else:  # after_execute_meta\n            if response is None:\n                raise ValueError(\"response is required for after_execute_meta\")\n            result_response: \"ToolExecutionResponse\" = response\n            for modifier in modifiers:\n                if modifier.type == type:\n                    # Check if modifier should be applied\n                    should_apply = (\n                        (len(modifier.tools) == 0 and len(modifier.toolkits) == 0)\n                        or tool in modifier.tools\n                        or toolkit in modifier.toolkits\n                    )\n\n                    if should_apply and modifier.modifier is not None:\n                        result_response = t.cast(AfterExecuteMeta, modifier.modifier)(\n                            tool, toolkit, session_id, result_response\n                        )\n            return result_response\n\n    # For regular modifiers\n    result: ModifierInOut","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/core/models/_modifiers.py#L623-L659","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Ensure a ToolExecutionResponse exists before applying after_execute_meta modifiers — only register after_execute_meta modifiers on the post-response path of your pipeline","If you meant to mutate input parameters before execution, use type='before_execute' instead of 'after_execute_meta'","Check that the tool execution actually succeeded and produced a response before your wrapper calls the modifier layer","Upgrade @composio/core / composio packages to matching versions in case modifier type strings changed between releases"],"exampleFix":"# before\ntoolkit.add_modifier(my_modifier, type=\"after_execute_meta\")\n# applied in a code path where response is None\n\n# after\nif response is not None:\n    toolkit.add_modifier(my_modifier, type=\"after_execute_meta\")\n# or, for pre-execution param mutation:\ntoolkit.add_modifier(my_modifier, type=\"before_execute\")","handlingStrategy":"type-guard","validationCode":"if response is None:\n    raise RuntimeError(\"tool execution produced no response; skipping after_execute_meta modifiers\")\nresult = apply_modifier_by_type(modifiers, \"after_execute_meta\", response=response, ...)","typeGuard":"def has_response(exec) -> TypeGuard[ToolExecutionResponse]:\n    return getattr(exec, \"response\", None) is not None","tryCatchPattern":"try:\n    apply_modifier_by_type(modifiers, \"after_execute_meta\", response=response, ...)\nexcept ValueError as e:\n    if \"response is required\" in str(e):\n        logger.warning(\"no response to post-process; skipping modifier\")\n    else:\n        raise","preventionTips":["Only register after_execute_meta modifiers on post-response execution paths","Use before_execute for parameter mutation before a response exists","Guard the apply call with `if response is None: return`"],"tags":["python","modifiers","tool-execution"],"backgroundTag":"invalid-argument-state","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}