lutzroeder/netron · error · Error

Expected 'bias'.

Error message

Expected 'bias'.

What it means

Generated protobuf requirement check: a binary-decoded caffe2.QTensorProto is missing the required 'bias' field. It is the third of the four mandatory QTensorProto fields (precision, scale, bias, is_signed) validated by decode().

Source

Thrown at source/caffe2-proto.js:274

                case 11:
                    message.axis = reader.int32();
                    break;
                case 12:
                    message.is_multiparam = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        if (!Object.prototype.hasOwnProperty.call(message, 'precision')) {
            throw new Error("Expected 'precision'.");
        }
        if (!Object.prototype.hasOwnProperty.call(message, 'scale')) {
            throw new Error("Expected 'scale'.");
        }
        if (!Object.prototype.hasOwnProperty.call(message, 'bias')) {
            throw new Error("Expected 'bias'.");
        }
        if (!Object.prototype.hasOwnProperty.call(message, 'is_signed')) {
            throw new Error("Expected 'is_signed'.");
        }
        return message;
    }

    static decodeText(reader) {
        const message = new caffe2.QTensorProto();
        reader.start();
        while (!reader.end()) {
            const tag = reader.tag();
            switch (tag) {
                case "dims":
                    reader.array(message.dims, () => reader.int64());
                    break;
                case "precision":
                    message.precision = reader.int32();

View on GitHub (pinned to d8a543f5f8)

Solutions

  1. Re-generate the quantized model file with a compatible toolchain
  2. Confirm the transfer completed (checksum/size)
  3. Inspect the payload with protoc --decode_raw for field presence
  4. Verify the parser is reading the tensor at the correct offset in the container
Defensive patterns

Strategy: validation

Validate before calling

const REQUIRED = ['precision','scale','bias','is_signed'];
const missing = REQUIRED.filter((k) => !(k in qt));
if (missing.length) throw new Error(`QTensorProto missing: ${missing.join(', ')}`);

Type guard

function isQTensor(m) {
  return m != null && ['precision','scale','bias','is_signed']
    .every((k) => Object.prototype.hasOwnProperty.call(m, k));
}

Try / catch

try {
  caffe2.QTensorProto.decode(reader);
} catch (e) {
  if (/^Expected '(precision|scale|bias|is_signed)'\.$/.test(e.message)) {
    // invalid input; skip tensor and continue with warning
  } else throw e;
}

Prevention

When it happens

Trigger: Decoding QTensorProto wire data where precision and scale were read but the bias field never appeared — truncated message or wrong schema version on the producer side.

Common situations: Corrupt/incomplete quantized model downloads; models quantized by forks with a different QTensorProto layout; stream misalignment while parsing concatenated tensors.

Related errors


AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27). Data as JSON: /api/errors/3e683c3a7808844b. Report an issue: GitHub.