{"record":{"id":"4174c6de2f42b8cb","repo":"lutzroeder/netron","slug":"expected-name","errorCode":null,"errorMessage":"Expected 'name'.","messagePattern":"Expected 'name'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"source/caffe2-proto.js","lineNumber":1194,"sourceCode":"                case 1:\n                    message.name = reader.string();\n                    break;\n                case 2:\n                    message.device_id = reader.array(message.device_id, () => reader.int32(), tag);\n                    break;\n                case 3:\n                    message.extra_info = reader.string();\n                    break;\n                case 4:\n                    message.backend_options.push(caffe2.BackendOptions.decode(reader, reader.uint32()));\n                    break;\n                default:\n                    reader.skipType(tag & 7);\n                    break;\n            }\n        }\n        if (!Object.prototype.hasOwnProperty.call(message, 'name')) {\n            throw new Error(\"Expected 'name'.\");\n        }\n        return message;\n    }\n\n    static decodeText(reader) {\n        const message = new caffe2.PartitionInfo();\n        reader.start();\n        while (!reader.end()) {\n            const tag = reader.tag();\n            switch (tag) {\n                case \"name\":\n                    message.name = reader.string();\n                    break;\n                case \"device_id\":\n                    reader.array(message.device_id, () => reader.int32());\n                    break;\n                case \"extra_info\":\n                    message.extra_info = reader.string();","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/lutzroeder/netron/blob/d8a543f5f847ef596aa58858d6adcf5d75545f7f/source/caffe2-proto.js#L1176-L1212","documentation":"Generated binary decoder for caffe2.PartitionInfo throws when the decoded message lacks the required 'name' field. The proto marks name as required, so wire data that never sets field 1 fails verification after the decode loop.","triggerScenarios":"PartitionInfo.decode() on bytes with no name field — mis-sliced sub-buffers, empty/truncated payloads, or data encoded by a schema where the field moved.","commonSituations":"Reading partition info sections from caffe2 network/partition files, manually slicing embedded messages with wrong offsets, or cross-version model interchange.","solutions":["Decode the enclosing message and access partition_info through it so lengths/offsets are correct.","Re-encode the source with a complete PartitionInfo including name.","Verify buffer non-empty and starts with a valid field-1 tag before decoding.","Regenerate the JS from the matching .proto."],"exampleFix":"// before\nconst pi = caffe2.PartitionInfo.decode(chunk); // throws Expected 'name'\n\n// after\nconst net = caffe2.NetDef.decode(fullBuffer);\nconst pi = net.partition_info[i]; // properly framed sub-message with name present","handlingStrategy":"try-catch","validationCode":"if (chunk.length===0 || (chunk[0]>>3)!==1) throw new RangeError('PartitionInfo buffer missing name field framing');","typeGuard":"const isPartitionInfoLike = (o) => o != null && typeof o.name === 'string';","tryCatchPattern":"try { pi = caffe2.PartitionInfo.decode(chunk); } catch (e) { if (/Expected 'name'/.test(e.message)) { decode enclosing NetDef and read partition_info; } else throw e; }","preventionTips":["Prefer decoding the top-level message and navigating down.","Verify buffer lengths when extracting embedded messages.","Keep .proto and generated JS in sync with model files."],"tags":["protobuf","required-field","caffe2","decode"],"backgroundTag":"protobuf-missing-required-field","analyzedSha":"d8a543f5f847ef596aa58858d6adcf5d75545f7f","analyzedAt":"2026-08-27T19:21:42.082Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}