{"record":{"id":"5d2de1210afcc851","repo":"alibaba/Sentinel","slug":"bad-invocation-instance-5d2de1","errorCode":null,"errorMessage":"Bad invocation instance","messagePattern":"Bad invocation instance","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-adapter/sentinel-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/DubboUtils.java","lineNumber":29,"sourceCode":" * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.alibaba.csp.sentinel.adapter.dubbo;\n\nimport com.alibaba.dubbo.rpc.Invocation;\n\n/**\n * @author Eric Zhao\n */\npublic final class DubboUtils {\n\n    public static final String DUBBO_APPLICATION_KEY = \"dubboApplication\";\n\n    public static String getApplication(Invocation invocation, String defaultValue) {\n        if (invocation == null || invocation.getAttachments() == null) {\n            throw new IllegalArgumentException(\"Bad invocation instance\");\n        }\n        return invocation.getAttachment(DUBBO_APPLICATION_KEY, defaultValue);\n    }\n\n    private DubboUtils() {}\n}\n","sourceCodeStart":11,"sourceCodeEnd":36,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-adapter/sentinel-dubbo-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/dubbo/DubboUtils.java#L11-L36","documentation":"Thrown by DubboUtils.getApplication() in the legacy Sentinel Dubbo (com.alibaba.dubbo) adapter when the Invocation is null or its attachment map is null. The utility reads the consumer's application name from the 'dubboApplication' attachment to attribute traffic origins. It is a fail-fast programming-error signal (IllegalArgumentException), not a flow-control event.","triggerScenarios":"Calling DubboUtils.getApplication(null, default); passing an Invocation whose getAttachments() returns null; SentinelDubboProviderFilter/ConsumerFilter invoked with a hand-constructed or mocked Invocation that never had attachments populated.","commonSituations":"Unit tests of the old Alibaba Dubbo adapter with incomplete mocks; custom filters on the legacy Dubbo (<=2.6.x / com.alibaba) chain stripping attachments; null Invocation leak from a broken async Dubbo callback.","solutions":["Guard the call: check invocation != null && invocation.getAttachments() != null before invoking","Fix test mocks to return a non-null attachment map","Inspect custom Dubbo filters for Invocation replacement that drops attachments"],"exampleFix":"// before\nString app = DubboUtils.getApplication(invocation, \"unknown\");\n\n// after\nString app = (invocation != null && invocation.getAttachments() != null)\n    ? DubboUtils.getApplication(invocation, \"unknown\")\n    : \"unknown\";","handlingStrategy":"validation","validationCode":"if (invocation != null && invocation.getAttachments() != null) {\n    app = DubboUtils.getApplication(invocation, \"unknown\");\n} else {\n    app = \"unknown\";\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call legacy adapter utilities with unmocked or wrapped Invocations","Keep unit-test mocks complete: attachments must be a non-null map"],"tags":["dubbo","adapter","illegal-argument","null-check","rpc","legacy"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}