pxb1988/dex2jar · error · CantNotFixContentException

A

Error message

A

What it means

OP35c assembles invoke-kind instructions (35c format), which can reference at most 5 registers. The constructor counts the argument register array and, if more than 5 registers are supplied, throws CantNotFixContentException with message 'A'. The 35c format's 4-bit count field simply cannot encode a larger invocation.

Solutions

  1. Use the invoke-*/range (3rc format, e.g. invoke-virtual/range) when the call needs more than 5 registers, with a contiguous register block.
  2. Rearrange registers so the invoked registers are contiguous and switch to the range form.
  3. Reduce parameter count (package parameters into an array/object) or split the call via a helper method.
  4. Guard before emission: if (args.length > 5) use range variant; catch CantNotFixContentException as a safety net.

Example fix

// before: 6 registers in 35c format
new OP35c(Op.INVOKE_STATIC, new int[]{v0,v1,v2,v3,v4,v5}, method);
// after: use range format with contiguous registers
new OP35c(Op.INVOKE_STATIC_RANGE, new int[]{5, firstReg}, method);
Defensive patterns

Strategy: validation

Validate before calling

if (args.length > 5) {
    // emit invoke-*/range (3rc) with contiguous registers instead
    emitInvokeRange(op.rangeVariant(), args.size(), firstReg, method);
} else {
    emitInvoke(op, args, method);
}

Try / catch

try {
    new OP35c(op, args, item);
} catch (CantNotFixContentException e) {
    // switch to the range format for >5 registers
    emitRangeFormat(op, args, item);
}

Prevention

When it happens

Trigger: Emitting an invoke-virtual/super/direct/static/interface or invoke-kind/range op through OP35c with args.length > 5, e.g. a static method call with 6+ parameters passed as individual registers.

Common situations: Translating Java methods with many parameters (plus 'this' for instance calls); code generators that forget to switch to invoke-*/range for large calls;dex translation of APIs with long parameter lists.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/72fb5ff69ae1099e. Report an issue: GitHub.

Appendix: source

Thrown at dex-writer/src/main/java/com/googlecode/d2j/dex/writer/CodeWriter.java:753

            }
        }

        public void fit() {
            if (op == CONST_STRING && (idxItem.index > 0xFFFF || idxItem.index < 0)) {
                op = CONST_STRING_JUMBO;
            }
        }
    }

    public static class OP35c extends OpInsn {
        final BaseItem item;
        int A, C, D, E, F, G;

        public OP35c(Op op, int[] args, BaseItem item) {
            super(op);
            int A = args.length;
            if (A > 5) {
                throw new CantNotFixContentException(op, "A", A);
            }
            this.A = A;
            switch (A) { // [A=5] op {vC, vD, vE, vF, vG},
            case 5:
                G = args[4];
                checkContentU4bit(op, "vG", G);
            case 4:
                F = args[3];
                checkContentU4bit(op, "vF", F);
            case 3:
                E = args[2];
                checkContentU4bit(op, "vE", E);
            case 2:
                D = args[1];
                checkContentU4bit(op, "vD", D);
            case 1:
                C = args[0];
                checkContentU4bit(op, "vC", C);

View on GitHub (pinned to b5bda4fb49)