Tencent/tinker · critical · ExceptionWithContext

Instruction format %s not supported

Error message

Instruction format %s not supported

What it means

ExceptionWithContext from BuilderMutableMethodImplementation's instruction converter: the switch over instruction formats has no case for the format of an instruction being converted into builder form. The bundled dexlib2 simply does not know how to build that format.

Source

Thrown at tinker-build/tinker-patch-lib/src/main/java/org/jf/dexlib2/builder/BuilderMutableMethodImplementation.java:768

            case Format3rc:
                setInstruction(location, newBuilderInstruction3rc((Instruction3rc) instruction));
                return;
            case Format51l:
                setInstruction(location, newBuilderInstruction51l((Instruction51l) instruction));
                return;
            case PackedSwitchPayload:
                setInstruction(location,
                        newBuilderPackedSwitchPayload(location, codeAddressToIndex, (PackedSwitchPayload) instruction));
                return;
            case SparseSwitchPayload:
                setInstruction(location,
                        newBuilderSparseSwitchPayload(location, codeAddressToIndex, (SparseSwitchPayload) instruction));
                return;
            case ArrayPayload:
                setInstruction(location, newBuilderArrayPayload((ArrayPayload) instruction));
                return;
            default:
                throw new ExceptionWithContext("Instruction format %s not supported", instruction.getOpcode().format);
        }
    }

    @Nonnull
    private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex,
                                                           @Nonnull Instruction10t instruction) {
        return new BuilderInstruction10t(
                instruction.getOpcode(),
                newLabel(codeAddressToIndex, codeAddress + instruction.getCodeOffset()));
    }

    @Nonnull
    private BuilderInstruction10x newBuilderInstruction10x(@Nonnull Instruction10x instruction) {
        return new BuilderInstruction10x(
                instruction.getOpcode());
    }

    @Nonnull

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. Upgrade Tinker (and tinker-patch-lib's dexlib2) to a version matching your build toolchain
  2. Pin AGP/d8 to a version whose dex output the Tinker release supports
  3. If you maintain a fork, add the missing format case in BuilderMutableMethodImplementation
Defensive patterns

Strategy: try-catch

Try / catch

try {
    // dex parse/rewrite
} catch (org.jf.util.ExceptionWithContext e) {
    if (String.valueOf(e.getMessage()).contains("Instruction format")) {
        // dex uses a format unknown to this dexlib2: upgrade toolchain, skip dex
    } else { throw e; }
}

Prevention

When it happens

Trigger: A dex contains an instruction whose opcode format is not among the cases handled in newBuilderInstruction (unexpected/unhandled format), hit while Tinker parses the dex for diffing or patching.

Common situations: Newer ART instruction formats (from newer AGP/d8 versions or new Dalvik opcodes) not supported by the older dexlib2 that Tinker bundles; dex mutated by instrumentation tools.

Related errors


AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14). Data as JSON: /api/errors/a2b80ecc5f55ccb8. Report an issue: GitHub.