lutzroeder/netron · error · Error
Expected 'precision'.
Error message
Expected 'precision'.
What it means
Generated protobuf requirement check: after binary-decoding a caffe2.QTensorProto, the required field 'precision' was not present. Quantized tensor protos must carry precision, scale, bias and is_signed; decode() throws on the first missing one in declaration order.
Source
Thrown at source/caffe2-proto.js:268
case 9:
message.scales = reader.doubles(message.scales, tag);
break;
case 10:
message.biases = reader.doubles(message.biases, tag);
break;
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();View on GitHub (pinned to d8a543f5f8)
Solutions
- Re-export the quantized model with a caffe2 build matching the library's schema
- Verify file integrity to rule out truncation
- Make sure the decoder is applied to actual quantized tensor data, not ordinary TensorProto bytes
- Inspect the message with protoc --decode_raw to see which fields are actually present
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 {
const qt = caffe2.QTensorProto.decode(reader);
} catch (e) {
if (/^Expected '(precision|scale|bias|is_signed)'\.$/.test(e.message)) {
// invalid quantized tensor: skip and report, do not retry
} else throw e;
} Prevention
- Export quantized models only from compatible caffe2 builds
- Treat any missing-required-field error as fatal data corruption
- Keep schema and toolchain versions pinned together
When it happens
Trigger: Decoding a quantized tensor blob from a caffe2 model where the serialized QTensorProto omits the precision field — truncated message, wrong bytes being parsed as QTensorProto, or a producer using a different schema revision.
Common situations: Loading quantized caffe2 models exported by a different (older/newer) caffe2 version; corrupt downloads; accidentally pointing the QTensor decoder at raw float tensor bytes.
Related errors
AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27).
Data as JSON: /api/errors/1e17a1cd062957a2.
Report an issue: GitHub.