lutzroeder/netron · error · Error
Expected 'name'.
Error message
Expected 'name'.
What it means
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.
Source
Thrown at source/caffe2-proto.js:1194
case 1:
message.name = reader.string();
break;
case 2:
message.device_id = reader.array(message.device_id, () => reader.int32(), tag);
break;
case 3:
message.extra_info = reader.string();
break;
case 4:
message.backend_options.push(caffe2.BackendOptions.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
if (!Object.prototype.hasOwnProperty.call(message, 'name')) {
throw new Error("Expected 'name'.");
}
return message;
}
static decodeText(reader) {
const message = new caffe2.PartitionInfo();
reader.start();
while (!reader.end()) {
const tag = reader.tag();
switch (tag) {
case "name":
message.name = reader.string();
break;
case "device_id":
reader.array(message.device_id, () => reader.int32());
break;
case "extra_info":
message.extra_info = reader.string();View on GitHub (pinned to d8a543f5f8)
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.
Example fix
// before const pi = caffe2.PartitionInfo.decode(chunk); // throws Expected 'name' // after const net = caffe2.NetDef.decode(fullBuffer); const pi = net.partition_info[i]; // properly framed sub-message with name present
Defensive patterns
Strategy: try-catch
Validate before calling
if (chunk.length===0 || (chunk[0]>>3)!==1) throw new RangeError('PartitionInfo buffer missing name field framing'); Type guard
const isPartitionInfoLike = (o) => o != null && typeof o.name === 'string';
Try / catch
try { pi = caffe2.PartitionInfo.decode(chunk); } catch (e) { if (/Expected 'name'/.test(e.message)) { decode enclosing NetDef and read partition_info; } else throw e; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Reading partition info sections from caffe2 network/partition files, manually slicing embedded messages with wrong offsets, or cross-version model interchange.
Related errors
AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27).
Data as JSON: /api/errors/4174c6de2f42b8cb.
Report an issue: GitHub.