{"record":{"id":"64c636aab17d6f9c","repo":"pxb1988/dex2jar","slug":"can-t-find-label-for-op-label","errorCode":null,"errorMessage":"can't find label for ${op} ${label}","messagePattern":"can't find label for (.+?) (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"d2j-smali/src/main/java/com/googlecode/d2j/smali/SmaliCodeVisitor.java","lineNumber":177,"sourceCode":"            DexStmtNode s = needCareStmts.get(i);\n            if (s instanceof DexLabelStmtNode) {\n                DexLabelStmtNode ss = (DexLabelStmtNode) s;\n                if (ss.label == label) {\n                    labelIndex = i;\n                }\n            }\n        }\n        return labelIndex;\n    }\n\n    /* package */void visitF31tStmt(final Op op, final int reg, final DexLabel label) {\n        add(new DexStmtNode(op) {\n\n            @Override\n            public void accept(DexCodeVisitor cv) {\n                int labelIndex = findLabelIndex(label);\n                if (labelIndex < 0 || labelIndex >= needCareStmts.size()) {\n                    throw new RuntimeException(\"can't find label for \" + op + \" \" + label);\n                }\n\n                switch (op) {\n                case PACKED_SWITCH:\n                    PackedSwitchStmt packedSwitchStmt = (PackedSwitchStmt) needCareStmts.get(labelIndex + 1);\n                    cv.visitPackedSwitchStmt(op, reg, packedSwitchStmt.firstCase, packedSwitchStmt.labels);\n                    break;\n                case SPARSE_SWITCH:\n                    SparseSwitchStmt sparseSwitchStmt = (SparseSwitchStmt) needCareStmts.get(labelIndex + 1);\n                    cv.visitSparseSwitchStmt(op, reg, sparseSwitchStmt.cases, sparseSwitchStmt.labels);\n                    break;\n                case FILL_ARRAY_DATA:\n                    ArrayDataStmt arrayDataStmt = (ArrayDataStmt) needCareStmts.get(labelIndex + 1);\n                    Object v;\n                    byte[] vs = arrayDataStmt.objs;\n                    switch (arrayDataStmt.length) {\n                    case 1: {\n                        v = vs;","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/d2j-smali/src/main/java/com/googlecode/d2j/smali/SmaliCodeVisitor.java#L159-L195","documentation":"Thrown inside the anonymous DexStmtNode's accept() when re-visiting a 31t-format instruction (fill-array-data / switch): findLabelIndex(label) scanned the already-collected needCareStmts and no DexLabelStmtNode with a matching label exists. It means the label referenced by the smali instruction was never defined (or was attached to a different code body), so the branch/in payload target cannot be resolved.","triggerScenarios":"Thrown at d2j-smali/src/main/java/com/googlecode/d2j/smali/SmaliCodeVisitor.java:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the smali source for a label declaration that matches the referenced label name and add the missing ':label' line","If the label is intentionally absent (dead payload), replace the 31t instruction with a nop or drop the statement before visiting","Ensure label objects are shared between the jump instruction and its DexLabelStmtNode so findLabelIndex can match by identity"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}