{"record":{"id":"1e17a1cd062957a2","repo":"lutzroeder/netron","slug":"expected-precision","errorCode":null,"errorMessage":"Expected 'precision'.","messagePattern":"Expected 'precision'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"source/caffe2-proto.js","lineNumber":268,"sourceCode":"                case 9:\n                    message.scales = reader.doubles(message.scales, tag);\n                    break;\n                case 10:\n                    message.biases = reader.doubles(message.biases, tag);\n                    break;\n                case 11:\n                    message.axis = reader.int32();\n                    break;\n                case 12:\n                    message.is_multiparam = reader.bool();\n                    break;\n                default:\n                    reader.skipType(tag & 7);\n                    break;\n            }\n        }\n        if (!Object.prototype.hasOwnProperty.call(message, 'precision')) {\n            throw new Error(\"Expected 'precision'.\");\n        }\n        if (!Object.prototype.hasOwnProperty.call(message, 'scale')) {\n            throw new Error(\"Expected 'scale'.\");\n        }\n        if (!Object.prototype.hasOwnProperty.call(message, 'bias')) {\n            throw new Error(\"Expected 'bias'.\");\n        }\n        if (!Object.prototype.hasOwnProperty.call(message, 'is_signed')) {\n            throw new Error(\"Expected 'is_signed'.\");\n        }\n        return message;\n    }\n\n    static decodeText(reader) {\n        const message = new caffe2.QTensorProto();\n        reader.start();\n        while (!reader.end()) {\n            const tag = reader.tag();","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/lutzroeder/netron/blob/d8a543f5f847ef596aa58858d6adcf5d75545f7f/source/caffe2-proto.js#L250-L286","documentation":"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.","triggerScenarios":"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.","commonSituations":"Loading quantized caffe2 models exported by a different (older/newer) caffe2 version; corrupt downloads; accidentally pointing the QTensor decoder at raw float tensor bytes.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const REQUIRED = ['precision','scale','bias','is_signed'];\nconst missing = REQUIRED.filter((k) => !(k in qt));\nif (missing.length) throw new Error(`QTensorProto missing: ${missing.join(', ')}`);","typeGuard":"function isQTensor(m) {\n  return m != null && ['precision','scale','bias','is_signed']\n    .every((k) => Object.prototype.hasOwnProperty.call(m, k));\n}","tryCatchPattern":"try {\n  const qt = caffe2.QTensorProto.decode(reader);\n} catch (e) {\n  if (/^Expected '(precision|scale|bias|is_signed)'\\.$/.test(e.message)) {\n    // invalid quantized tensor: skip and report, do not retry\n  } else throw e;\n}","preventionTips":["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"],"tags":["caffe2","protobuf","qtensor","required-field"],"backgroundTag":"protobuf-missing-required-field","analyzedSha":"d8a543f5f847ef596aa58858d6adcf5d75545f7f","analyzedAt":"2026-08-27T19:21:42.082Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}